#K46087. Longest Substring Without Repeating Characters

    ID: 27898 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string s, your task is to compute the length of the longest substring that does not contain any repeating characters.

You are required to implement an efficient solution that ideally runs in \(O(n)\) time using the sliding window technique along with a hash map to keep track of characters' last indices.

For example, given the input abrkaabcdefghijjxxx, the longest substring without repeating characters is abcdefghij with a length of 10.

inputFormat

The input consists of a single line containing the string s. The string can be empty or contain up to 105 characters.

outputFormat

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

## sample
abrkaabcdefghijjxxx
10