#225. 字符串中特定间隔字符配对计数
字符串中特定间隔字符配对计数
Count Pairs in String
Background
Congcong is studying the properties of strings. He has defined a special way of "pairing".
Problem Description
We'll say that a "pair" in a string is two instances of a character separated by exactly one character. So "AxA" the 'A's make a pair. Pairs can overlap, so "AxAxA" contains 3 pairs -- 2 for 'A' and 1 for 'x'. Recursively compute the number of pairs in the given string.
Input Format
Input is given from standard input in the following format.
s
Output Format
Output to standard output in the following format.
count
Sample
axa
1
axax
2
axbx
1
Sample Explanation
For Sample 1 "axa\