NINJA2 - PATHETIC STRINGS

no tags 

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


hide comments
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
1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa

(length=29)

Last edit: 2016-07-12 09:02:34
tarang219: 2016-04-03 18:44:54

what will be output for "aaaaaaab" 1 or 3
pathetic string can be of single type character??
plz help mombassa

Last edit: 2016-04-04 12:52:33
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.
cadeb

lalit_nit: 2016-02-22 13:41:12

Give output for "cccbb" please...
Edit: @gurugs You should solve it frst :p ....

Last edit: 2016-03-02 21:42:32
Ankit: 2016-02-20 19:42:27

Stuck at wrong answer now. Some weird boundary condition ?

Ankit: 2016-02-20 18:07:01

My code runs properly on ideone giving correct result. But it gives SIGSEGV run time error on spoj.
@mombasa, can u help ?

Last edit: 2016-02-20 18:14:54

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