J - Anagram

Time limit: 1 s
Memory limit: 256 MiB
Languages: C, C++, Java, Python, ... (details)

Two strings are anagrams of each other if the letters of one string can be rearranged to form the other string. Given a string $s$, find the number of pairs of substrings of $s$ which are anagrams of each other.

For example $s = wow$ the list of all anagrammatic pairs is $[w, w], [wo, ow]$ at positions $([0..0], [2..2])$ and $([0..1], [1..2])$ respectively.

Input

A single line containing a string $s$ to analyze. String $s$ only contains lowercase English characters $[a..z]$ and $|s| \le 100$.

Output

Print the number of anagrammatic pairs in the given string.

Sample test(s)

Input
abba
Output
4
Input
abcd
Output
0

Hints

No anagrammatic pairs exist in the second test case as no character repeats.