eolymp
bolt
Try our new interface for solving problems
Problems

Secret code

Secret code

Johnny English almost caught Pascal Sauvage, but still at the last moment he disappeared behind a door with a combination lock.

Fortunately, the villain dropped the note with the string s. After carefully considering what had happened, Johnny realized that the code to the door was the string t, resulting from the string s with exactly one exchange of characters in two different positions (Pascal Sauvage would clearly not have been smart enough for more).

Johnny does not believe in luck, so he needs to know how many different codes he will have to enter in order to be guaranteed to open the door. Since he is not very good at string problems, he asked you to compute this number for him.

Input

One line s (1 ≤ |s| ≤ 105), consisting of lowercase Latin letters - a string from a note dropped by Sauvage.

Output

Print one number - the number of codes that must be entered in order to open the door with certainty.

Time limit 1 second
Memory limit 128 MiB
Input example #1
abacaba
Output example #1
15
Input example #2
aaaaaa
Output example #2
1
Source 2018 Цикл Интернет-олимпиад для школьников, первая командная олимпиада сезона, October 14, Problem D