#K431. Anagram Checker

    ID: 27234 Type: Default 1000ms 256MiB

Anagram Checker

Anagram Checker

In this problem, you are given several pairs of strings. Your task is to determine whether each pair of strings are anagrams of each other. Two strings are said to be anagrams if one string can be rearranged to form the other. In mathematical terms, for two strings \(s_1\) and \(s_2\), they are anagrams if and only if

\(sorted(s_1) = sorted(s_2)\)

where sorted(s) denotes the string formed by arranging the characters of \(s\) in non-decreasing order. Each test case consists of two strings and the output should be YES if they are anagrams, and NO otherwise.

inputFormat

The first line of input contains a single integer (T) denoting the number of test cases. Each of the following (T) lines contains two space-separated strings.

outputFormat

For each test case, output a single line containing YES if the two strings are anagrams of each other, or NO otherwise.## sample

3
listen silent
triangle integral
hello world
YES

YES NO

</p>