Submit | All submissions | Best solutions | Back to list |
ANGRAM - Anagram verifier |
An anagram is a rearrangement of the letters of an existing phrase to create a new phrase. For example, ananagram of "Tom Marvolo Riddle" is "I Am Lord Voldemort".
Given two phrases, answer whether they are anagrams. The phrases will be given in the lowercase letters a-z with spaces removed.
(Note: For this problem, every phrase is considered to be an anagram of itself.)
Input
The first line is an integer T (between 1 to 20, inclusive), which is the number of supposed anagram pairs to follow.
On the next T lines will be two sequences of lowercase letters. These are the two phrases. Neither will exceed 10000 characters.
Output
For each supposed anagram pair, print a line with "true" if they are anagrams and "false" otherwise.
Example
Input:
3
tommarvoloriddle iamlordvoldemort
aaa aba
iamaweakishspeller williamshakespeare
Output:
true
false
true
Added by: | Paul Draper |
Date: | 2012-02-13 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 NCSHARP JULIA PYPY3 |
Resource: | BYU ACM Winter 2012 |