#C9687. Longest Substring Without Repeating Characters

    ID: 53807 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string s, find the length of the longest substring that contains no repeated characters. A substring is a continuous block of characters. For example, if s = "abcabcbb", the longest substring without repeating characters is "abc" which has a length of 3.

The problem requires you to process multiple test cases. For each test case, output the length of the longest substring that does not contain any duplicates.

inputFormat

The input is given via standard input (stdin). The first line contains an integer T, the number of test cases. Each of the following T lines contains a string. Note that the string may be empty.

outputFormat

For each test case, output the length of the longest substring without repeating characters on a new line. The output should be sent to standard output (stdout).## sample

3
abcabcbb
bbbbb
pwwkew
3

1 3

</p>