You are given a string of length . A string is called twin if the characters of the string can be split into two groups such that the occurrence of each character is equal in both groups.
Find the number of twin substrings of .
Input Format:
Output Format:
For each test case, print the number of twin substrings of .
Constraints:
contains lower-case English letters
First test case:-
Substrings are twin as they can divide into and respectively. Hence, the answer is .
Second test case:-
Substring is twin as they can divide into . Hence, the answer is .