Smallest window in a string containing all the characters of another string
Submissions: 7529   Accuracy:

31.11%

  Difficulty: Easy   Marks: 2

Given a string S and text t. Output the smallest window in the string having all characters of the text. Both the string and text contains small case letters.

Input:
First line contains T , the number of test cases and each test contains 2 lines having a string S and t.

Output:
Output the smallest window of the string containing all the characters of the text. If such window doesn`t exist or this task can not be done then print -1.

Constraints:
1 <= T <= 100
1 <= N, X <= 1000

Example:
Input:
2

timetopractice
toc
zoomlazapzo
oza

Output:
toprac
apzo

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Yash Kodesia
Author: Yash Kodesia 1


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.