#K88017. Longest Substring Without Repeating Characters

    ID: 37215 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string s, your task is to find the longest substring that does not contain any repeating characters. The substring must be contiguous and if there are multiple substrings with the maximum length, return the first one encountered from the left.

Note: The problem statement uses the English alphabet and is case-sensitive.

Example: For s = "abcabcbb", the answer is "abc" because it is the longest substring without repeating characters.

inputFormat

The input consists of a single line containing the string s. The string is read from the standard input (stdin).

Constraints:

  • s can be empty.
  • s contains printable characters.

outputFormat

Output the longest substring without repeating characters. The output should be printed to the standard output (stdout).

## sample
abcabcbb
abc