#K88152. Minimum Operations to Make All Characters Same
Minimum Operations to Make All Characters Same
Minimum Operations to Make All Characters Same
Given a string s consisting of lowercase English letters, determine the minimum number of operations required to make all characters in the string identical. In each operation, you can change any single character to any other character.
Mathematically, if the frequency of the most frequent character in the string is \( f_{max} \) and the length of the string is \( n \), then the answer is \( n - f_{max} \).
This problem will test your ability to compute frequency counts and perform simple arithmetic operations efficiently.
inputFormat
The input is given via standard input (stdin) and has the following format:
T s1 s2 ... sT
Here, the first line contains an integer T, the number of test cases. Each of the following T lines contains a single string s composed only of lowercase English letters.
outputFormat
For each test case, output the minimum number of operations on a separate line using standard output (stdout).
For each string, the output is computed as:
\( \text{operations} = |s| - (\text{maximum frequency among characters in } s) \)
## sample1
aabcc
3
</p>