X246: countTriple

We'll say that a "triple" in a string is a char appearing three times in a row. Return the number of triples in the given string. The triples may overlap.

Examples:

countTriple("abcXXXabc") -> 1
countTriple("xxxabyyyycd") -> 3
countTriple("a") -> 0

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.