Given a string s, find the length of the longest substring without repeating characters.
s: “workattech”
Result: 6
Explanation: Longest vaild substring is “workat”.
s: “mississippi”
Result: 3
Explanation: Longest vaild substrings are “mis” and “sip”, both of length 3.
The first line contains an integer ‘T’ denoting the number of test cases.
For each test case, the input has two lines:
For each test case, the output contains a line with an integer denoting the length of the longest substring in s having distinct characters.
2
10
workattech
11
mississippi
6
3
1 <= T <= 10
1 <= n <= 106
The string s consists of lowercase English characters.