Minimum Window Containing a Multiset
You are given two strings s and t. Find the shortest contiguous substring of s that
contains, for every character c, at least as many occurrences of c as t does. In other
words, the substring's multiset of characters must be a superset (with multiplicity) of t's
multiset of characters.
If several shortest substrings exist, output the one that starts earliest in s. If no
substring of s satisfies the requirement, output an empty line instead.
Input
The first line contains the string s (1 ≤ |s| ≤ 10^6).
The second line contains the string t (1 ≤ |t| ≤ 10^6).
Both strings consist only of visible printable ASCII characters (character codes 33 through 126 inclusive — letters, digits and punctuation, but no spaces).
Output
Print the shortest substring of s whose character multiset contains t's character multiset,
breaking ties by the leftmost starting position. If no such substring exists, print an empty
line.
Notes
In the first example, t requires two as and one b, so no valid window can be shorter than
|t| = 3. The substring "aab" starting at the second character of s already has exactly two
as and one b, achieving that minimum.