#C4613. Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
Given a string s
, your task is to compute the length of the longest substring that contains no repeating characters.
For example, when s = "abcabcbb"
, the longest substring with all unique characters is "abc", which has a length of 3. A common efficient approach to solve this problem is the sliding window technique, which can achieve a time complexity of \(O(n)\), where \(n\) is the length of the string.
This problem tests your understanding of strings and hash-based lookup methods, and is a popular interview question.
inputFormat
The input consists of a single line containing the string s
. The string can contain any printable characters.
outputFormat
Output a single integer representing the length of the longest substring without repeating characters.
## sampleabcabcbb
3