#C948. Anagram Checker
Anagram Checker
Anagram Checker
Given two strings, determine whether they are anagrams of each other. Two strings are considered anagrams if the sorted sequence of their characters (after converting both to lowercase) are identical. Formally, if \( s_1 \) and \( s_2 \) are the two strings, they are anagrams if and only if
\( sorted(s_1.lower()) = sorted(s_2.lower()) \).
Note that spaces, punctuation, and other special characters are taken into account, and case differences are ignored. For example, "listen"
and "silent"
are anagrams whereas "dormitory"
and "dirty room!"
are not.
inputFormat
The input is provided via stdin and consists of exactly two lines. The first line contains the first string \( s_1 \) and the second line contains the second string \( s_2 \). Both strings may contain letters, digits, spaces, or special characters.
outputFormat
Output a single line to stdout with either True
or False
(without quotes). Output True
if the two strings are anagrams of each other, otherwise output False
.
listen
silent
True