#C2709. Anagram Validator
Anagram Validator
Anagram Validator
Given two strings, determine if they are anagrams of each other by ignoring spaces, punctuation, and letter casing. Two strings are considered anagrams if, after removing all non-alphabet characters and converting each letter to lowercase, the sorted sequence of characters in both strings is identical.
In mathematical terms, let \( S_1 \) and \( S_2 \) be the processed versions of the two input strings such that
\[ S = \text{sort}(\{ c \in \text{lower}(s) : c \text{ is an alphabet letter} \}) \]
The two strings are anagrams if \( S_1 = S_2 \).
inputFormat
The input consists of two lines:
- The first line contains a string str1.
- The second line contains a string str2.
The strings may include spaces, punctuation, and mixed case letters.
outputFormat
Output a single line to standard output. Print True
if the two strings are anagrams of each other; otherwise, print False
.
Listen
Silent
True