Longest K Unique Characters Substring

easy
1.Given a string you need to print the size of the longest possible substring that has exactly k unique characters. 2.If there is no possible substring print -1. 3.Example For the string aabacbebebe and k = 3 the substring will be cbebebe with length 7. 4.You have to complete the function print() which should print the size of the longest substring having 'k' unique characters.

Input Format

1.First Line contains a string 'S'. 2.Second line contains an integer 'k'.

Output Format

Print the size of the longest possible substring that has exactly k unique characters.

Constraints

1<=k<=10

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
aabacbebebe
3
Output
7
Previous
Longest Harmonious Subsequence
Next
Longest Palindrome

Related Questions