AmazonOA #55
Count Removable Indices
估计中等可在线判题
Given a lowercase string that is already a palindrome, count the indices whose removal still leaves a palindrome; equal characters at different indices are counted separately.
输入格式
A single line containing a palindrome string of length 2..100000.
输出格式
Output a single integer answer.
样例 1
输入:
zzz
输出:
3
样例 2
输入:
abba
输出:
2
样例 3
输入:
abcba
输出:
1
样例说明
Example 1: removing any z gives zz, 3 indices in total. Example 2: only one of the two middle b can be removed, giving aba, 2 in total. Example 3: only removing the center c gives abba, so the answer is 1.