Master of copy and paste

No attempts yetTime limit2sMemory limit256 MB

Problem

Hanshin types slowly, so he does almost everything at school with copy and paste. Typing a character by hand costs 1 second, so typing nn characters costs nn seconds. Pasting the clipboard costs 1 second no matter how long its contents are.

The clipboard holds the string pp, and its contents never change. Starting from an empty screen, Hanshin repeats two moves, typing a single character or pasting the whole of pp, until the screen shows exactly the string ss. Both moves append to the end of what he has built so far. With "bana" on the clipboard, building "banana" takes 3 seconds: paste "bana", then type 'n' and 'a'.

Find the minimum time needed to build ss.

Input

The first line contains the number of test cases TT (1T251 \le T \le 25).

Each of the next TT lines contains two strings ss and pp separated by a single space. The length of ss is between 1 and 10,000, the length of pp is between 1 and 100, and both strings consist of lowercase English letters.

Output

For each test case, print on its own line the minimum time in whole seconds that Hanshin needs to build ss using pp.