Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.21 KB | None | 0 0
  1. public int countTriple(String str) {
  2.     int count = 0;
  3.     for (int i = 0; i < str.length() - 2; i++)
  4.         if ((str.charAt(i) == str.charAt(i + 1)) && str.charAt(i) == str.charAt(i + 2))
  5.             count++;
  6.     return count;
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement