You are viewing a single comment's thread. Return to all comments →
C Solution :
int alternatingCharacters(char* s) { int i=0,j,count=0; while(s[i]!='\0'){ char ch = s[i]; j=i+1; while(s[j]==s[i] && s[j]!='\0'){ j++; i++; count++; } if(s[j]=='\0') break; i++; } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
Alternating Characters
You are viewing a single comment's thread. Return to all comments →
C Solution :