#C8167. Anagram Lexicographical Matching
Anagram Lexicographical Matching
Anagram Lexicographical Matching
You are given two strings. Your task is to determine if they are anagrams of each other. Two strings are anagrams if one string can be rearranged to form the other. In this problem, the rearrangement is done by sorting the characters in lexicographical order. Formally, given two strings \(S_1\) and \(S_2\), check if:
\(\texttt{sorted}(S_1) = \texttt{sorted}(S_2)\)
If they are equal, print YES; otherwise, print NO.
Note: The input is given via standard input (stdin) and the output should be printed to standard output (stdout).
inputFormat
The first line of input contains an integer \(T\) (\(T \ge 1\)), representing the number of test cases. Each of the next \(T\) lines contains two space-separated strings.
Example:
3 listen silent hello world a abc
outputFormat
For each test case, output a single line containing either YES (if the two strings are anagrams when their characters are sorted lexicographically) or NO (otherwise).
## sample1
listen silent
YES
</p>