#arc130a. [arc130_a]Remove One Character
[arc130_a]Remove One Character
Problem Statement
You are given a string of length . For each , let denote the string obtained by deleting the -th character from .
Find the number of pairs of integers that satisfy both of the conditions below.
Constraints
- is a string of length consisting of lowercase English letters.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
7
abbbcca
Sample Output 1
4
Here are the strings in order: bbbcca
, abbcca
, abbcca
, abbcca
, abbbca
, abbbca
, abbbcc
.
The following pairs satisfy the conditions.
Sample Input 2
4
xxxx
Sample Output 2
6
Sample Input 3
2
pp
Sample Output 3
1
Sample Input 4
2
st
Sample Output 4
0