#K61052. Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
Given a string s
, find the length of the longest substring without repeating characters. A substring is a contiguous sequence of characters within the string.
The solution must read input from standard input (stdin) and output the result to standard output (stdout). The input consists of a single string and the output should be an integer representing the length of the longest substring with all unique characters.
Formally, for a given string \( s \), you are to compute: \[ \text{LongestSubstring}(s) = \max_{i,j \text{ such that all characters in } s[i\dots j] \text{ are unique}} (j-i+1) \]
Note that the empty string has a longest substring length of 0.
inputFormat
The input is provided via standard input.
It consists of a single line containing a string s
(which may be empty) that only includes printable ASCII characters.
outputFormat
Print a single integer on standard output which is the length of the longest substring of s
that does not contain any repeating characters.
abcabcbb
3