All submissions for this problem are available.You are given a string S of length N and an integer K. The string contains alphabets, denoting different types of candies. The lower case and upper case alphabets denote same type of candies, i.e. A and a denote same type of candy. There are some special candies denoted by vowels. You want to eat all the candies but there are two restrictions.
You have to pick continous candies, i.e. a substring of the given string S.
The picked candies must have exactly K distinct special candies.
You have to find the maximum number of candies you can eat. If he can't eat any candy, print -1.
NOTE: The vowels are 'a', 'e', 'i', 'o' and 'u'. String S only contains lower and upper case alphabets.
-The first line of input contains an integer T denoting the number of test cases.
-Each testcase consists of two lines of input.
-The first line of each testcase consist of two integers N and K.
-The next line of the testcase contains the string S.
Print the maximum number of candies you can eat. If he can't eat any candy, print -1.
- $1 \leq T \leq 10$
- $1 \leq N \leq 10^6$
- $0 \leq K \leq 5$
- 30 points : $1 \leq N \leq 500$
- 70 point: Original Constraints
The maximum number of candies you can eat with exactly 1 distinct special candy is 14 ("cEBetwEEntheTw"). The special candy is "e".
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH 3.6|
Fetching successful submissions
If you are still having problems, see a sample solution here.