#C30. Anagram Detection
Anagram Detection
Anagram Detection
You are given two strings. Your task is to determine whether the two strings are anagrams of each other. Two strings are anagrams if after removing all non-alphanumeric characters and converting all letters to lowercase, their characters can be rearranged to form each other.
Note that if both strings are empty or one contains only spaces, they are considered valid anagrams.
Mathematically:
Let \( S_1 \) and \( S_2 \) be the processed strings. Then they are anagrams if and only if:
\[ sorted(S_1) = sorted(S_2) \quad \text{.} \]inputFormat
The input is given from stdin in two lines. The first line contains the first string, and the second line contains the second string.
outputFormat
Output to stdout a single line which is either True
or False
depending on whether the two strings are anagrams.
Listen!
Silent
True