NINJA2 - PATHETIC STRINGS
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
hide comments
wjli:
2020-08-01 01:03:26
Bruce force -- Hint: what's the possible # of repetitions? |
|
:D:
2018-10-05 12:13:25
Some hints:
|
|
lalit_nit2:
2016-07-12 11:35:09
Frustrated by this.... WA at 11 case... Someone Help |
|
Dushyant Singh:
2016-07-12 09:01:53
What will be the answer for
|
|
tarang219:
2016-04-03 18:44:54
what will be output for "aaaaaaab" 1 or 3
|
|
GUDDU:
2016-03-24 16:35:25
Any possible hints ?
|
|
mehmetin:
2016-03-13 15:40:45
"You can change any letter to any other letter". That sentence in the description is very important... Last edit: 2016-03-13 17:00:47 |
|
gurugs:
2016-03-02 06:14:46
@lalit_nit 3 might be the output.
|
|
lalit_nit:
2016-02-22 13:41:12
Give output for "cccbb" please...
|
|
Ankit:
2016-02-20 19:42:27
Stuck at wrong answer now. Some weird boundary condition ? |
Added by: | mombassa |
Date: | 2016-02-17 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |