#C11259. Substring Swap Anagram

    ID: 40555 Type: Default 1000ms 256MiB

Substring Swap Anagram

Substring Swap Anagram

You are given t test cases. In each test case, you are provided with two strings s1 and s2. You can perform any number of swaps of substrings in s1 (or equivalently, rearrange the characters arbitrarily).

Your task is to determine if it is possible to transform s1 into s2 using such operations. In other words, you need to check whether the two strings are anagrams.

This condition can be formally stated as follows:

$$\forall c \in \Sigma,\; \text{count}(c,s1) = \text{count}(c,s2)$$

Output YES if s1 can be transformed into s2 and NO otherwise.

inputFormat

The first line contains an integer t --- the number of test cases.

Each of the following t lines contains two space-separated strings s1 and s2.

You may assume that the lengths of s1 and s2 are equal for each test case.

outputFormat

For each test case, print a single line containing YES if the string s1 can be transformed into s2 by performing any number of substring swaps, or NO otherwise.

## sample
3
abcd dcba
face cafe
abc xyz
YES

YES NO

</p>