لینکهای مفید برای شرکت در مسابقه:
در طول مسابقه، میتوانید سؤالات خود را از قسمت «سؤال بپرسید» مطرح کنید.
Mathematicians have always loved generalizing mathematics to everything. They even contributed lots of optimizations and valuable formulas to Computer Science. Have you heard about String Multiplication? What do you think will happen if we write the following code in python?
print (3 * "abc")
As you might have guessed, it prints "abcabcabc". It is equal to
print("abc" + "abc" + "abc")
We define string is divisible by string , if there is some number which satisfies the equation .
Your task is simple. Given two strings and . What is the minimum number of characters which should be removed from , so is divisible by ?
The first line of the input contains the number of the test cases.
Each test case consists of two lines. The first line contains string consisting of lowercase English letters.
The second line contains string consisting of lowercase English letters.
For each test case print a single integer, the minimum number of characters which should be removed.