#C7967. Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
Given a string s, your task is to find the length of the longest substring that does not contain any repeating characters.
Definition: A substring is a contiguous sequence of characters within the string. For example, for the input "abcabcbb", the answer is 3, corresponding to the substring "abc".
The solution should consider all possible substrings and provide the maximum length among those without any duplicate characters.
Note that an empty string has a longest substring length of 0.
inputFormat
The first line of input contains an integer T
indicating the number of test cases. Each of the following T
lines contains a string s from which you need to determine the length of the longest substring without repeating characters.
Example:
2 abcabcbb bbbbb
outputFormat
For each test case, output the length of the longest substring without repeating characters. Each result should be printed on its own line.
Example Output:
3 1## sample
2
abcabcbb
bbbbb
3
1
</p>