TWO STRINGS

3.2

4 votes
Easy
Problem

Given two strings of equal length, you have to tell whether they both strings are identical.

Two strings S1 and S2 are said to be identical, if any of the permutation of string S1 is equal to the string S2. See Sample explanation for more details.

Input :

  • First line, contains an intger 'T' denoting no. of test cases.
  • Each test consists of a single line, containing two space separated strings S1 and S2 of equal length.

Output:

  • For each test case, if any of the permutation of string S1 is equal to the string S2 print YES else print NO.

Constraints:

  • 1<= T <=100
  • 1<= |S1| = |S2| <= 10^5
  • String is made up of lower case letters only.

SAMPLE INPUT

3

sumit mitsu

ambuj jumba

abhi hibb

SAMPLE OUTPUT

YES

YES

NO

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?