Longest Substring Without Repeating Characters

Practice this coding question on Coding Gurukul.

Problem statement

A scanner reads a lowercase character stream. Find the length of the longest contiguous portion that contains no repeated character. Characters cannot be skipped when forming the portion.

Input format

One nonempty lowercase English string.

Output format

Print the maximum length.

Constraints

1 <= string length <= 100000.

Sample input

abcaefb

Sample output

5

Sign in to run or submit a solution in C++, Java or Python.