spoj#ANAGR. Anagrams

Anagrams

Two strings are said to be anagrams of each other if the letters of one string may be rearranged to make the other string.  In this problem you’ll be given two strings. Your job is to find if the two strings are anagrams of each other. If they are not anagrams then find the lexicographically smallest palindrome (in lowercase letters) that may be appended to the end of one of the two strings so that they become anagrams of each other.

The lower and upper case letters are considered equivalent. The number of spaces  or any other punctuation is not important.


INPUT:

The first line of the input contains a number T, the number of test cases. T test cases follow. Each test case consists of two lines, one string in each line.


OUTPUT:

For each test case output a single line. Print ‘YES’ (without the quotes) if the two strings are anagrams of each other. If they are not, then print the lexicographically smallest string as discussed above. If no such string exists, then print ‘NO LUCK’ (without the quotes).


CONSTRAINTS:

1<=T<=100

1<=length of the strings<=100


SAMPLE TEST CASES:

INPUT:

4
Computer programmer
mature germ romp crop
Awaaay
away
internet
web
the terminator
I’m rotten hater

OUTPUT:

YES
aa
NO LUCK
YES