#C10423. Longest Substring Without Repeating Characters

    ID: 39627 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

You are given a string s consisting of lowercase and uppercase English letters. Your task is to find the length of the longest substring without repeating characters.

For example, consider s = "abcabcbb". The answer is 3, as the longest substring without repeating characters is "abc".

This problem can be approached using a sliding window technique. At each index i, you maintain a window without duplicate characters. When you find a repeating character, update the start of the window using the formula: \( start = index[char] + 1 \), where index[char] is the last index at which the character was seen.

inputFormat

The input consists of a single line containing the string s.

Note: The string may be empty.

outputFormat

Output a single integer representing the length of the longest substring in s that does not contain any repeating characters.

## sample
abcabcbb
3