#K86752. Longest Unique Substring
Longest Unique Substring
Longest Unique Substring
Given a string s, your task is to find the length of the longest contiguous substring that contains only unique characters. A substring is a sequence of characters that appears consecutively in s.
For example, if s is abcabcbb
, then the longest substring without repeating characters is abc
and its length is 3. Similarly, for bbbbb
, the length is 1, and for pwwkew
the length is 3.
The solution should account for all characters and be efficient even for large input strings.
inputFormat
The input consists of a single line containing the string s. The string may consist of letters, digits, and special characters. Note that the string can be empty.
outputFormat
Output a single integer representing the length of the longest substring with all unique characters.
## sampleabcabcbb
3
</p>