#K50612. Minimum Removals for Unique Characters
Minimum Removals for Unique Characters
Minimum Removals for Unique Characters
You are given (t) test cases. For each test case, you are provided with a string. Your task is to determine the minimum number of characters to remove from the string so that each character appears only once. In other words, for every character that occurs more than once, you need to remove all but one occurrence.
For example, in the string "aabbcc", you need to remove one 'a', one 'b', and one 'c', resulting in 3 removals. Use standard input (stdin) and output (stdout) for reading input and writing output.
inputFormat
The first line contains an integer (t), the number of test cases. Each of the following (t) lines contains a string (s). The string can be empty and consists of lowercase and/or uppercase letters.
outputFormat
For each test case, print a single integer on a new line representing the minimum number of removals required so that each character appears only once.## sample
2
aabbcc
abc
3
0
</p>