← 返回 capitalone 的题目列表Count Case-Insensitive Symmetric Triplets in a String
类型:online_judge
Problem: Count Case-Insensitive Symmetric Triplets in a String
Given a string s, count the number of contiguous substrings of length 3 s[i..i+2] (0 <= i <= len(s)-3) such that:
s[i] and s[i+2] are the same case-insensitively.
Return the total count.
Input
One line string s.
Output
An integer: the number of valid contiguous triplets.
Constraints
1 <= |s| <= 2 * 10^5
Examples
s = "axA" → output 1
s = "cXcBdB" → output 2
Example
Input
axA
Output
1