All submissions for this problem are available.
Huge population has been a major problem in India. To reduce the population growth, Pratyush was asked to come up with a plan. Pratyush, being an intelligent as he is, came up with the following plan: A man with name M is allowed to marry a woman with name W, only if M is anagram of W or W is anagram of M. One name is an anagram of another if the second is simply a rearrangement of the first. For example, 'heart' and 'earth' are anagrams. Your task is to determine whether a couple is allowed to marry or not, according to Pratyush's rule.
The first line of the input contains an integer T denoting the number of test cases.
The description of T test cases follows :
- Each test case contains two space separated strings M and W.
For each test case print "YES" if they are allowed to marry, else print "NO".
- 1 ≤ T ≤ 100
- 1 ≤ Length of M,W ≤ 50000
- All names are in lowercase English letters only.
Input: 2 rahul radhika ajay jaya Output: NO YES
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions