#K44377. Longest Unique Substring
Longest Unique Substring
Longest Unique Substring
Given a string s
, your task is to find the length of the longest substring that contains no duplicate characters.
You are required to implement an algorithm to compute the maximum length of a substring with all unique characters. Mathematically, if we denote a substring by s[i..j], find the maximum value of j - i + 1 such that every character in s[i..j] is unique. This can be expressed as:
\( \max_{0 \leq i \leq j < n} \{ j - i + 1 \mid \text{all characters in } s[i..j]\text{ are distinct} \} \)
The problem tests your understanding of sliding window techniques and hash table usage.
inputFormat
The input consists of a single string s
provided via standard input (stdin). The string may contain letters, digits, and/or symbols and can be empty.
outputFormat
Output a single integer representing the length of the longest substring without repeating characters to standard output (stdout).
## sampleabcabcbb
3