#K60087. Check for Anagrams
Check for Anagrams
Check for Anagrams
Given two strings, determine whether they are anagrams of each other. Two strings are anagrams if they consist of the same letters in any order, once non-alphabetic characters are removed and all letters are converted to lowercase.
In other words, if we define a cleaning function \(\text{clean}(S)\) which removes all characters not in the set [A-Za-z] and converts the remaining characters to lowercase, then two strings \(S_1\) and \(S_2\) are anagrams if and only if
[ \text{Counter}(\text{clean}(S_1)) = \text{Counter}(\text{clean}(S_2)) ]
Print "True" if the strings are anagrams according to this rule, and "False" otherwise.
inputFormat
The input consists of two lines. Each line contains a string. The first line is the first string, and the second line is the second string.
outputFormat
Print a single line with either "True" if the two strings are anagrams (ignoring non-alphabet characters and case), or "False" if they are not.## sample
Listen
Silent
True