G. Kozak Vus and Lines
Kozak Vus recently encountered the following problem:
Given a string , determine the number of substrings that meet the following criteria:
The substring must contain at least characters.
All characters in the substring are identical except for one.
For instance, the substrings aab
and cccdc
meet these criteria, whereas ab
, ccc
, and aabbaa
do not.
A string is considered a substring of string if can be derived by removing zero or more characters from the beginning and zero or more characters from the end of .
Assist Kozak Vus in solving this problem.
Input
The first line contains the string (), composed of lowercase Latin letters.
Output
Output a single integer — the number of substrings that satisfy the specified conditions.
Examples
Scoring
A solution that works correctly for will earn at least points.
A solution that works correctly for will earn at least points.