#C115. Anagram Pair Verification

    ID: 40822 Type: Default 1000ms 256MiB

Anagram Pair Verification

Anagram Pair Verification

You are given two strings. Your task is to determine whether they are anagrams of each other by considering only letter characters and ignoring case. In other words, you should remove all non-letter characters, convert the remaining letters to lowercase, and then check if the sorted characters of the two resulting strings are identical.

For example, the strings "cinema" and "iceman" are anagrams, as are "A gentleman" and "Elegant man!". However, "Hello" and "World" are not anagrams. Additionally, if either input string is empty, the output should be False (case-sensitive).

The underlying idea is based on the property that two anagrams have the same multiset of letters. Mathematically, if we let \( s_1 \) and \( s_2 \) be the filtered lowercase versions of the input strings, then the strings are anagrams if and only if: \[ \text{sorted}(s_1)=\text{sorted}(s_2) \]

inputFormat

The input consists of two lines. The first line contains the first string and the second line contains the second string. Both strings may include spaces and punctuation. Note that an empty string is considered invalid.

outputFormat

Output a single line containing either True or False (without quotes). The output should be True if the two strings are anagrams under the specified conditions, and False otherwise.

## sample
cinema
iceman
True