ANAG - Anagram

no tags 

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
chakkriii: 2016-08-01 14:44:42

piece of cake :)

irataba: 2015-10-17 09:06:09

Tried C++14 and got WA but the same code with clang gives AC. wtf?

dumb: 2015-02-05 18:48:36

can solve this in many ways but used maps this time

maurice37: 2014-07-01 11:56:54

be careful the length of both strings may not be same!! it costs me three WA.

himanshu: 2013-06-13 12:16:16

there are more than 20 chars ,i took 26 and it got ac :)

Last edit: 2013-06-13 12:31:50
Ouditchya Sinha: 2013-03-23 04:40:25

Piece of Cake... :)

Unnati Gupta: 2013-02-05 16:49:42

easier in python with sort function.. :)

PubLic_AvenGeR: 2012-01-12 12:43:27

thnx 2 noname,,ac wid 22 :)

vD: 2011-12-09 07:06:41

yes there are more than 20 characters in the input string.. i took 25 n got AC!!

galactocalypse: 2011-08-13 05:23:29

Same problem here. Used 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