#C7742. Smallest Window Substring

    ID: 51647 Type: Default 1000ms 256MiB

Smallest Window Substring

Smallest Window Substring

In this problem, you are given two strings, (s) and (t). Your task is to find the smallest contiguous substring (also known as a window) in (s) that contains all the characters of (t). If there is no such substring, output "No such window". This problem can be efficiently solved using the sliding window technique. The length of the window can be computed by the formula (window_length = right - left + 1), where (left) and (right) are the boundaries of the current window.

inputFormat

The input begins with an integer (T) denoting the number of test cases. Each test case consists of two lines: the first line contains the string (s) and the second line contains the string (t). Both strings consist of only lowercase letters.

outputFormat

For each test case, print the smallest window substring of (s) that contains every character from (t). If no such window exists, print "No such window". Each result should be output on a new line.## sample

1
thisisateststring
tist
tstri

</p>