Friday, July 22, 2016

266A - Stones on the Table

#include<bits/stdc++.h>
#include<cstring>
#include<cstdio>

using namespace std;

int main()
{
 int t,l,i,ct;
 cin>>t;
 char a[t];
 cin>>a;
 l= strlen(a);
 ct=0;
 for(i=1; i<l; i++)
 {
  if(a[i-1]==a[i]) ct++;
 }
 
 cout<<ct<<endl;

 return 0;
}

No comments:

Post a Comment

Thank you for commenting. Please wait for response :)