#K77817. Anagram Checker
Anagram Checker
Anagram Checker
You are given pairs of strings. For each pair, determine whether the two strings are anagrams of each other. Two strings are anagrams if one can be rearranged to form the other. In other words, if the sorted sequence of characters in both strings is identical, then they are anagrams.
Formally, given two strings \( s_1 \) and \( s_2 \), check whether:
[ sorted(s_1) = sorted(s_2) ]
If the condition holds, print YES
; otherwise, print NO
.
inputFormat
The first line contains an integer \( T \) representing the number of test cases. Each of the following \( T \) lines contains two space-separated strings \( s_1 \) and \( s_2 \).
outputFormat
For each test case, output a single line containing YES
if the two strings are anagrams, or NO
otherwise.
3
listen silent
triangle integral
apple papel
YES
YES
YES
</p>