#K62247. Anagram Checker
Anagram Checker
Anagram Checker
Given two strings, determine whether they are anagrams of each other. Two strings are considered anagrams if, after removing all spaces, the frequency of each character in one string is equal to the frequency in the other.
In other words, for every character \(c\), the condition \[ Count_{s1}(c) = Count_{s2}(c) \] must hold. For example, "listen" and "silent" are anagrams, while "apple" and "pale" are not.
Your task is to write a program that reads multiple test cases from standard input, and for each test case, outputs whether the given pair of strings are anagrams.
inputFormat
The input begins with an integer \(T\) on a single line representing the number of test cases. Each test case consists of two lines:
- The first line contains the first string.
- The second line contains the second string.
The strings may contain spaces.
outputFormat
For each test case, output a single line containing either True
if the two strings are anagrams (ignoring spaces), or False
otherwise.
2
listen
silent
apple
pale
True
False
</p>