#K77462. Anagram Check but Not Identical
Anagram Check but Not Identical
Anagram Check but Not Identical
Given two strings \(s_1\) and \(s_2\), determine whether \(s_2\) is an anagram of \(s_1\) but not identical to \(s_1\). Two strings are considered anagrams if their characters can be rearranged to form each other. However, if the two strings are exactly the same, they do not meet the criteria. For example, if \(s_1 = \text{listen}\) and \(s_2 = \text{silent}\), the answer is "YES". In contrast, if \(s_1 = \text{apple}\) and \(s_2 = \text{apple}\), the answer is "NO".
inputFormat
The first line of input contains an integer \(T\) (\(1 \leq T \leq 1000\)), representing the number of test cases. Each of the following \(T\) lines contains two space-separated strings \(s_1\) and \(s_2\), each consisting of lowercase English letters.
outputFormat
For each test case, output "YES" if \(s_2\) is an anagram of \(s_1\) and the two strings are not identical. Otherwise, output "NO". Each output should be on a separate line.
## sample6
listen silent
triangle integral
apple apple
hello olelh
abc def
abcd abcde
YES
YES
NO
YES
NO
NO
</p>