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; }
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