All submissions for this problem are available.
Shibam is given a string S consisting of only lower characters of the English alphabet. He is asked to compress the string. He decides to compress the string by choosing any one character from the English alphabet and deleting all occurences of the character from the string. But Shibam is unable to decide which character to choose and compress the string S and he asks you to tell the minimum length of the compressed string.
First line will contain T, number of testcases.
Each test case will contain a string S consisting of only lower case letters of the English alphabet.
For each test case,print the minimum length of the compressed string.
- 1 ≤ T ≤ 1000
- 1 ≤ |S| ≤ 1000
Input: 2 arqpadparta mnxprtpvghap Output: 7 9
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.