Given a string s which contains lower alphabetic characters, the task is to check if its possible to remove at most one character from this string in such a way that frequency of each distinct character becomes same in the string.
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains a string s.
For each test case in a new line print 1 if its possible to make frequencies of all characters equal else print 0.
1 <= T <= 1000
1 <= length of strings <= 10000
Testcase 2: It is not possible to make frequency of each character same just by removing at most one character from above string.