Codeforces Round #163 (Div. 2), problem: (A) Stones on the Table solution: http://ideone.com/zTRo04
#include <iostream> #include <cstdio> #include <cstring> using namespace std; int main() { int cnt, n; char s[55]; cnt=0; scanf("%d\n%s", &n, s); for(int i=1; i<strlen(s); i++) if(s[i]==s[i-1]) cnt++; printf("%d", cnt); return 0; }
No comments:
Post a Comment