Smallest Distinct Window

easy
1. Given a string 's'. The task is to find the smallest window length that contains all the characters of the given string at least one time. EXAMPLE "aabcbcdbca", then the result would be 4 as of the smallest window will be "dbca".

Input Format

A string.

Output Format

Return an integer(required length)

Constraints

1 <= |S| <= 10^5

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
aabcbcdbca
Output
4
Previous
Smaller On Left
Next
Smallest Subarray With All-occurrences-of-a-most-frequent-element

Related Questions