An anagram is formed by rearranging the letters of a word. The aim of this problem is test whether a string is an anagram of a word or not. No word (or string) will have have more than 50 characters.
The input will consist of a word on one line. The following line will contain a number, n (1 <= n <= 30000), of strings to be tested.
cares 5 scare races cares another acres
ANAGRAM ANAGRAM IDENTICAL NOT AN ANAGRAM ANAGRAM