#K95597. Anagram Pairs Checker

    ID: 38898 Type: Default 1000ms 256MiB

Anagram Pairs Checker

Anagram Pairs Checker

Given several test cases, each consisting of a pair of words, determine whether the two words are anagrams of each other. Two words are considered anagrams if, after converting all letters to lowercase and sorting them, they become identical. Formally, for two words \(s_1\) and \(s_2\), they are anagrams if

\(\text{sorted}(s_1) = \text{sorted}(s_2)\)

Your task is to read input from standard input (stdin) and print the corresponding result for each test case to standard output (stdout).

inputFormat

The first line contains an integer (T) ((1 \leq T \leq 1000)) representing the number of test cases. Each of the following (T) lines contains two words separated by a space.

outputFormat

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

5
listen silent
hello world
Triangle Integral
apple pabble
Dormitory DirtyRoom
YES

NO YES NO YES

</p>