#P1009. String minus

String minus

题目描述

For a string aa like abcdabcd the plus operation is very obvious that a+a=abcdabcda+a=abcdabcd but little m defined a new way to operate the strings, which is the operation minus.

For two given strings aa and bb:

If the length of aa is not shorter than the length of bb then do aba-b else do bab-a

aba-b means removing the longest sequence from aa by referencing bb, and after that if there are left characters in bb do a+ba+b or b+ab+a if we do bab-a at first.

For example:

Let us define A=aabadA=aabad and B=abcB=abc

Then ABA-B is first removing the longest sequence from AA by referencing BB, after that A=aadA=aad (removes aa at index 1 and removes bb at index 3, because if we can remove some characters, we will immediately remove them) after that B=cB=c

Then do A+BA+B, so AB=aadcA-B=aadc

For more precisely, reference only from the begin of string to the end of string and will only do once, For example:

We suppose A=abcA=abc and B=acbB=acb the referencing operation is first check A[1]A[1], it is obvious that A[1]=B[1]=aA[1]=B[1]=a so remove both character aa from AA and BB. Then check A[2]A[2], we can see taht A[2]!=B[2]A[2]!=B[2], so we continue referencing, then we can see that A[3]=B[2]=cA[3]=B[2]=c so we both remove character cc from AA and BB, then we can get the answer for ABA-B is bbbb

picture: some strings

输入格式

The first line contains one positive integer T(1leTle1000)T (1\\le T\\le 1000) indicating the number of the test cases.

Then for next TT lines, each line contains two strings a,b(1lea,ble100)a,b (1\\le|a|,|b|\\le100)

It is guaranteed that a,ba,b only contains lower-case English letters.

输出格式

For each test case, print one line aba-b

样例

6 
aabad abc 
a baaa 
a aaa 
b a 
cdaab caab 
abc acb 

aadc 
baa 
aa 
ba 
d 
bb

提示

Please notice for the sixth test case abcabc-acbacb equals bbbb