spoj#NINJA2. PATHETIC STRINGS
PATHETIC STRINGS
Problem statement:
A string is said to be “PATHETIC” if all the characters in it are repeated the same number of times. You are given a string of length n, what is the minimum number of changes required to make a string “PATHETIC”. The string has only lower case letters and you can change any letter to any other letter.
Input Format
The first line contains an integer T, the number of test cases. This is followed by T test cases each containing 1 line:
Each testcase consists of a string composed of lowercase letters.
Output Format
For each testcase, print in a new line the minimum number of changes required.
Constraints
1 ≤ T ≤ 1370
1 ≤ n ≤ 1991
Sample Input :
2
bbaccaaa
ccaacb
Output:
2
1