Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int countTriple(String str) {
- int count = 0;
- for (int i = 0; i < str.length() - 2; i++)
- if ((str.charAt(i) == str.charAt(i + 1)) && str.charAt(i) == str.charAt(i + 2))
- count++;
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement