#K64467. Anagram Checker

    ID: 31982 Type: Default 1000ms 256MiB

Anagram Checker

Anagram Checker

You are given a series of word pairs. For each pair, determine whether the two words are anagrams of each other.

An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, using all the original letters exactly once. For example, listen and silent are anagrams.

The problem requires you to take input from standard input (stdin) and output the results to standard output (stdout). The first line of the input contains a single integer \(T\) representing the number of test cases. Each of the following \(T\) lines contains two space-separated words. For each test case, output "YES" if the two words are anagrams of each other, otherwise output "NO".

inputFormat

The input is read from stdin and has the following format:

  • The first line contains an integer \(T\) (\(1 \le T \le 10^5\)), the number of test cases.
  • Each of the next \(T\) lines contains two non-empty strings separated by a space.

outputFormat

For each test case, print a single line to stdout containing "YES" if the two words are anagrams of each other, or "NO" otherwise.

## sample
2
listen silent
hello world
YES

NO

</p>