fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int count=0;
  7. int t;
  8. cin>>t;
  9. string s;
  10. cin>>s;
  11. for(int i=0;i<t;i++)
  12. {
  13. if(s[i]==s[i+1])
  14. {
  15. count++;
  16.  
  17. }
  18. }
  19. cout<<count<<endl;
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5288KB
stdin
5
RRRRR
stdout
4