You are given a string ‘STR’ consisting of lowercase English alphabets. Your take is to find out the minimum number of character deletions required such that each character in the final string has a unique frequency.
Input Format :
The first line contains an integer ‘T’, which denotes the number of test cases to be run. Then, the T test cases follow.
The first line of each test case contains a single string ‘STR’ denoting the initial string.
Output Format :
For each test case, print a single integer, denoting the minimum number of character deletions required such that each character in the final string has a unique frequency.
Output for each test case will be printed in a separate line.
Note :
You don’t have to print anything, it has already been taken care of. Just implement the given function.
Constraints :
1 <= T <= 10
2 <= |STR| <= 10^5
Where |STR| denotes the length of the initial string ‘STR’.
Time limit: 1 second