Smallest substring
Practice
3.9 (14 votes)
Algorithms
Binary search
Medium
Searching
Problem
78% Success 3915 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given a string \(S\) that is made of lowercase English alphabets. Determine the length of the smallest substring that contains the maximum number of distinct characters.

Input format
The only line of input consists of a string that is made of lower case English alphabets.

Output format
Print the required answer.

Constraints
\(1 \le |S| \le 10^5\) where \(|S|\) denotes the length of the string \(S\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
24 votes
Tags:
AlgorithmsApprovedData StructuresMediumOpenSorting
Points:20
446 votes
Tags:
MathematicsEasy
Points:30
11 votes
Tags:
AlgorithmsBinary SearchGreedy AlgorithmsMediumReadySearching