ANAG - Anagram
In this problem, you are given two strings S1 and S2, your task is to determine whether one string is an anagram of the other. An anagram of a string is a string obtained by permuting the letters of a string. For example aaba and aaab are anagrams, while abcd and deba are not.
Input
The first line would consist of the number of test cases 'T'. This would be followed by 'T' lines consisting of two space separated strings. The strings would consist of only letters 'a'-'z'. Each string would consist of no more than 25 characters.
Output
You have to print "YES" if one string is an anagram of the other or "NO" otherwise.
Example
Input: 2 aaba aaab abcd deba Output: YES NO
hide comments
Vishal Vivek:
2011-04-21 16:39:10
Stupid problem costed me 3 submissions for nothing. What a waste!!! What's NZEC? |
|
:(){ :|: & };::
2010-03-18 04:35:48
|
|
noname:
2010-01-15 16:10:02
Hi, I think there are words in the input that are 21 of letters long, which contradicts with the problem description (that textually says: "Each string would consist of no more than 20 characters" ) . I submitted the solution with two char[21] (20 for the word plus an extra for the '\0') and I got WA, but I got AC with two char[22].
|
Added by: | .:: Pratik ::. |
Date: | 2010-01-13 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: OBJC SQLITE |
Resource: | algoCrack Elim-I |