Length of the longest substring
Submissions: 7879   Accuracy:

37.71%

  Difficulty: Medium   Marks: 4

Given a string, find the length of the longest substring without repeating characters. For example, the longest substrings without repeating characters for “ABDEFGABEF” are “BDEFGA” and “DEFGAB”, with length 6.

Input:

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

Output:

Print the length of longest substring.

Constraints:

1 ≤ T ≤ 20
1 ≤ str ≤ 50

Example:

Input:
2
geeksforgeeks
qwertqwer

Output:
7
5

 

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

Author: rajatjha


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

to report an issue on this page.