Match the Color

SUB Inter University Prog...
Limits 1s, 512 MB

'Subha' is a girl of 5 years old. Already she can recognize almost all of the colors and shapes even she can count till hundred. One day her father bought her a lot of colorful balls to play a game with her.
Her father placed some colorful balls as the following style-

After placing these, her father asked her to replace some balls to make all of them to same color. The only condition is to replace minimum number of balls as possible.

Subha did it after trying several times. She changed 5 balls and made all of them as color G. But she can't count more than hundreds, so it'll be difficult for her if her father asks her to solve such a problem with thousand of balls. But as I know you don't have any limitation of counting. So please help her to solve it.

Input

Each line of input set will contain a sequence of alphabets [A-Z] where each of the distinct alphabets represents a distinct color. You may assume that each line of input will not have more than 1000 characters and will not have more than 100 test cases.

Output

For each line of input your task is to output the count of minimum number of balls to replace to make all of them to same color. If all of the balls of input already have same color, print a line "Done!" (without quotes).

Sample

InputOutput
GBYGRPO
GBYPR
GGGG
5
4
Done!

Submit

Login to submit.

Statistics

100% Solution Ratio
Neaj_MorshadEarliest, 2w ago
Neaj_MorshadFastest, 0.0s
Neaj_MorshadLightest, 131 kB
Neaj_MorshadShortest, 1152B
Toph uses cookies. By continuing you agree to our Cookie Policy.