You are viewing a single comment's thread. Return to all comments →
//java public static int alternatingCharacters(String s) { return (int)IntStream.range(0, s.length()-1).filter(i->s.charAt(i)==s.charAt(i+1)).count(); }
Alternating Characters
You are viewing a single comment's thread. Return to all comments →
//java public static int alternatingCharacters(String s) { return (int)IntStream.range(0, s.length()-1).filter(i->s.charAt(i)==s.charAt(i+1)).count(); }