#K54047. Minimum Length Substring
Minimum Length Substring
Minimum Length Substring
Given a string S, your task is to find the minimum length of a substring of S that contains at least one occurrence of every distinct character in S. Formally, let (C) be the set of unique characters in (S). You must find the smallest integer (L) such that there exists a substring of (S) with length (L) that contains every character (c \in C) at least once.
For example, if (S = "abcabcbb"), then the unique characters are ({a, b, c}) and the minimum length of a substring containing all of them is 3.
inputFormat
A single string (S) provided as input from standard input. The string consists of at least one character.
outputFormat
An integer printed to standard output representing the minimum length of a substring containing all unique characters of (S).## sample
abcabcbb
3