100 atcoder#ABC137C. [ABC137C] Green Bin
[ABC137C] Green Bin
Score : points
Problem Statement
We will call a string obtained by arranging the characters contained in a string in some order, an anagram of .
For example, greenbin
is an anagram of beginner
. As seen here, when the same character occurs multiple times, that character must be used that number of times.
Given are strings . Each of these strings has a length of and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers such that is an anagram of .
Constraints
- is a string of length .
- Each character in is a lowercase English letter.
- are all distinct.
Input
Input is given from Standard Input in the following format:
Output
Print the number of pairs of integers such that is an anagram of .
3
acornistnt
peanutbomb
constraint
1
acornistnt
is an anagram of constraint
. There are no other pairs such that is an anagram of , so the answer is .
2
oneplustwo
ninemodsix
0
If there is no pair such that is an anagram of , print .
5
abaaaaaaaa
oneplustwo
aaaaaaaaba
twoplusone
aaaabaaaaa
4
Note that the answer may not fit into a -bit integer type, though we cannot put such a case here.