1648 - 第四届“恒生杯”程序设计大赛决赛 F
Time Limit : 1 Second
Memory Limit : 256 MB
Given a string S and a string T, find the minimum substring in S which will contain all the characters in T.
S = "ADOBECODEBANC"
T = "ABC"
Minimum substring is "BANC".
The first line contains the number of test cases C. C test cases follow. Each case contains string S on the first line, String T on the second line.
1 <= T <= 100
1 <= string length <= 1000
Output C lines, one for each test case, containing the minimum substring.
- sample input
- sample output
If there is no such substring in S that covers all characters in T, return the string "$".
If there are multiple such substring, output the leftmost one.