BETA

Difficulty Level: Easy

Submissions: 6750 Accuracy:

28.87%

Longest Distinct characters in string
     

Given a string, find length of the longest substring with all distinct characters.  For example, for input "abca", the output is 3 as "abc" is the longest substring with all distinct characters.

Input:

The first line of input contains an integer T denoting the number of test cases.
The first line of each test case is String str.

Output:

Print length of smallest substring with maximum number of distinct characters.
Note: The output substring should have all distinct characters.

Constraints:

1 ≤ T ≤ 100
1 ≤ size of str ≤ 10000

Example:

Input
2
abababcdefababcdab
geeksforgeeks

 

Output:
6
7

** For More Input/Output Examples Use 'Expected Output' option **

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.