Are you sure you want to participate in this contest ?
If you select a team then virtual participation for other team members will be disabled. So, pick one if and only if your teammates are ready to compete with you.
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.
A single line containing a string $s$ to analyze. String $s$ only contains lowercase English characters $[a..z]$ and $|s| \le 100$.
Print the number of anagrammatic pairs in the given string.
No anagrammatic pairs exist in the second test case as no character repeats.