#K4611. Longest Substring Without Repeating Characters

    ID: 27904 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string ( s ), the task is to find the length of the longest substring that contains no repeated characters. A substring is defined as a contiguous sequence of characters within the string. For example, if ( s = ) "abcabcbb", the longest substring without repeating characters is "abc" and its length is 3.

It is expected to implement an efficient solution (for instance, using the sliding window approach) that works well even for long strings.

inputFormat

The input consists of a single line containing a string ( s ) (which may include spaces and other characters). The string is read from standard input (stdin).

outputFormat

Output a single integer representing the length of the longest substring of ( s ) without any repeating characters. The output should be written to standard output (stdout).## sample

abcabcbb
3