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.
For eg. A = “aabcbcdbca”, then the result would be 4 as of the smallest window will be “dbca”.
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains a string S.
For each test case in a new line print the length of the smallest such string.
1 <= T <= 100
1 <= |S| <= 105
Testcase 1: Smallest window size is 4 which is of "dbca" which consists all characters of the string.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.