#C14088. Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
You are given a string s. Your task is to find the length of the longest substring that does not contain any repeating characters.
For example, given the string abcabcbb
, the answer is 3
because the longest substring without repeating characters is abc
.
The problem can be formulated as follows:
Find \( L \), where \[ L = \max_{0 \leq i \leq j < n} \{ j-i+1 \mid s[i\ldots j] \text{ has all unique characters} \}\]
Read the input from standard input and write the result to standard output.
inputFormat
The input consists of a single line containing the string s. The string may contain spaces and special characters.
You should read the input from stdin
.
outputFormat
Output a single integer which is the length of the longest substring of s that does not contain repeating characters.
The output should be written to stdout
.
abcabcbb
3