IntermediateRating 1400
Shortest Piece With Every Letter
Print the length of the shortest substring that contains every different character of the whole string.
Input
One string (length ≤ 10⁵).
Output
One integer.
Sample 1
Input
aabcbcdbca
Output
4
Sample 2
Input
aaab
Output
2
Output appears here