ninja12345's blog

By ninja12345, history, 3 years ago, In English

https://codeforces.com/problemset/problem/266/A int solve() { int n, c = 0; char cc, prev = 0; cin>>n; while(n--){ scanf("%c",&cc); if (cc == prev) c++; prev = cc; }

return c;

}

  • Vote: I like it
  • -1
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it +1 Vote: I do not like it

You writed prev=0 right? Now try to write prev='0'

I think now it'll work correct.