Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
|||||
2016-08-01 14:44:42
piece of cake :) |
|||||
2015-10-17 09:06:09
Tried C++14 and got WA but the same code with clang gives AC. wtf? |
|||||
2015-02-05 18:48:36 dumb
can solve this in many ways but used maps this time |
|||||
2014-07-01 11:56:54 maurice37
be careful the length of both strings may not be same!! it costs me three WA. |
|||||
2013-06-13 12:16:16 himanshu
there are more than 20 chars ,i took 26 and it got ac :) Last edit: 2013-06-13 12:31:50 |
|||||
2013-03-23 04:40:25 Ouditchya Sinha
Piece of Cake... :) |
|||||
2013-02-05 16:49:42 Unnati Gupta
easier in python with sort function.. :) |
|||||
2012-01-12 12:43:27 PubLic_AvenGeR
thnx 2 noname,,ac wid 22 :) |
|||||
2011-12-09 07:06:41 vD
yes there are more than 20 characters in the input string.. i took 25 n got AC!! |
|||||
2011-08-13 05:23:29 galactocalypse
Same problem here. Used char[22]. |