


Let ‘S1’ be “ABBCD” and ‘S2’ be “ABC”, so the smallest substring of ‘S1’ which contains all the characters of S1 is “ABBA”.
The first line contains a single integer T representing the number of test cases.
The first line of each test case contains the string ‘S1’.
The first line of each test case contains the string ‘S2’.
For each test case, print the smallest substring of S1 which contains all the characters of S2. Print an empty ( “” ) string if no substring of S1 contains all the characters of S2.
The output of each test case should be printed in a separate line.
You are not required to print anything, it has already been taken care of. Just implement the function.
1 <= T <= 10
1 <= |S1| <= 10^4
1 <= |S2| <= 10^4
The strings S1 and S2 contain only uppercase Latin alphabets.
Where |S| represents the length of string S.
Time Limit: 1sec
Generate all substrings of S1 and check which sub-strings contain all characters of S2. Return the smallest substring among them.
Initialize two-pointers and keep adjusting the two-pointers such that the window between the two-pointers contains all the characters of S2. Take the smallest window among such windows.