You are viewing a single comment's thread. Return to all comments →
EASY JAVA SOLUTION
public static int alternatingCharacters(String s) { // Write your code here
int count=0; for(int i=0;i<s.length()-1;i++) { if(s.charAt(i)==s.charAt(i+1)) count++; } 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 →
EASY JAVA SOLUTION
public static int alternatingCharacters(String s) { // Write your code here