#C3526. Shortest Substring with All Distinct Characters
Shortest Substring with All Distinct Characters
Shortest Substring with All Distinct Characters
Given a string \(s\), your task is to find the length of the shortest contiguous substring that contains every distinct character present in \(s\). In other words, if the set of distinct characters in \(s\) is \(\{c_1, c_2, \dots, c_k\}\), then find the minimum length \(L\) such that there exists a substring of length \(L\) which contains all \(c_1, c_2, \dots, c_k\).
Example: For \(s = \texttt{abca}\), the distinct characters are \(\{a, b, c\}\) and the shortest substring containing all these characters is \(\texttt{abc}\) with a length of 3.
inputFormat
The input consists of a single line containing the string \(s\). The string can include any visible characters.
outputFormat
Output a single integer representing the length of the shortest substring of \(s\) that contains all distinct characters of \(s\).
## sampleabca
3