Anagrams
InterviewTime limit1sMemory limit128 MB
Given two lowercase words, decide whether one can be rearranged into the other, and print the result with the words.
Problem
Two words and are given. If you can rearrange the order of the letters in to form , then and are called anagrams of each other.
Write a program that determines whether two given words are anagrams.
Input
The first line contains the number of test cases ().
Each of the following test cases consists of a single line containing two words separated by a space. Each word has length at most and consists only of lowercase English letters.
Output
For each test case, if the two words are anagrams, print
A & B are anagrams.
Otherwise, print
A & B are NOT anagrams.
on its own line, where A and B are the two words given in the input.