#C14493. Longest Substring Without Repeating Characters

    ID: 44148 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string s, your task is to find and output the longest substring that does not contain any repeated characters. An efficient solution using the sliding window technique with a time complexity of \(O(n)\) is required.

If there are multiple longest substrings, output the one that appears first.

For example, for the input "abcabcbb", the expected output is "abc".

inputFormat

The input is provided via standard input (stdin) as a single line string.

outputFormat

Print the longest substring without repeating characters to standard output (stdout).## sample

abcabcbb
abc