SP8758 MAIN8_E - Cover the string

Description

Given two strins A and B. You have to find the length of the smallest substring of A, such that B is the subsequence of this substing.

Input Format

First line contains T, the number of test cases. Then T test cases follow, 2 lines for each test case, 1st contains A and 2nd contain B. |A|

Output Format

For each test case print the answer in a new line. if no such substring exists print -1 instead.