#C14582. Longest Unique Substring Length

    ID: 44247 Type: Default 1000ms 256MiB

Longest Unique Substring Length

Longest Unique Substring Length

Problem Description:

You are given a string s. Your task is to compute the length of the longest substring of s that does not contain any repeating characters.

A substring is defined as a contiguous sequence of characters within the string. For example, for the input "abcabcbb", the longest substring without repeating characters is "abc", which has a length of 3.

The problem can be formally defined as follows:

Given a string \(s\) of length \(n\), find \[ \max_{0 \le i \le j < n} \{ j - i + 1 \; | \; s[i \ldots j] \text{ contains unique characters} \}. \]

Note: Your solution must read input from standard input (stdin) and write the output to standard output (stdout).

inputFormat

Input Format:

A single string representing the input. The string is provided through standard input (stdin). It may contain spaces and punctuation.

outputFormat

Output Format:

An integer representing the length of the longest substring of the given string that does not contain any repeated characters. The result should be output to standard output (stdout).

## sample
abcabcbb
3