#C6228. Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
Given a string s, your task is to find the length of the longest substring that does not contain any repeating characters.
A substring is defined as a contiguous sequence of characters within the string. Formally, if we denote the substring by s[i...j], then all characters in s[i...j] must be distinct. The goal is to maximize the length of such a substring.
The problem can be mathematically expressed as finding the maximum length such that for some indices i and j with 0 ≤ i ≤ j ≤ n, the substring s[i...j] contains no duplicate characters.
In latex, the constraint can be written as: \( \forall\; i \leq k < l \leq j,\; s[k] \neq s[l] \).
inputFormat
The input consists of a single line containing the string s. The string can include letters, digits, spaces, and other printable characters. It may also be empty.
outputFormat
Output a single integer representing the length of the longest substring of s that does not contain any repeating characters.
## sampleabcabcbb
3