Smallest Substring Of A String Containing All Unique Characters Of Itself

medium
1. You are given a string str.
2. You have to find the smallest window length that contains all the unique characters of the given string.

Input Format

A string

Output Format

A number representing smallest window length that contains all unique characters of the given string.

Constraints

1 <= length of string <= 10^6

Example

Input
aabcbcdbca
Output
4
Previous
Smallest Substring Of A String Containing All Characters Of Another String
Next
Longest Substring With Non Repeating Characters

Related Questions