Tuesday, January 21, 2020

Codeforces 266A Stones on the Table Solution in C

  1. #include <iostream>
  2. using namespace std;
  3. int main ()
  4. {
  5. int n,s=0;
  6. string m;
  7. cin>>n>>m;
  8. if (n==1)
  9. {
  10. cout<<"0"<<endl;
  11. return 0;
  12. }
  13. for (int i=0;i<n-1;i++)
  14. {
  15. if (m[i]==m[i+1]) s++;
  16. }
  17. cout<<s<<endl;
  18. return 0;
  19. }

No comments:

Post a Comment

Codeforces 131A cAPS lOCK Solution in C

#include <stdio.h> int main () { char ch [ 106 ]; int i , j , ck = 1 ; scanf ( "%s" , ch ); ...