#C12753. Anagram Checker
Anagram Checker
Anagram Checker
Given two strings, determine whether one string is an anagram of the other.
An anagram is a word or phrase formed by rearranging the letters of another, using all the original letters exactly once. For this problem, the comparison should:
- Ignore spaces
- Be case-insensitive
Formally, let \( S_1 \) and \( S_2 \) be the two input strings. Define \( \tilde{S} \) as the result of removing all spaces from \( S \) and converting it to lowercase. The strings are anagrams if and only if
\[
sorted(\tilde{S_1}) = sorted(\tilde{S_2})
\]
where sorted()
denotes the operation of sorting the characters of the string.
Your task is to implement a program that reads two lines from standard input and prints True
if the two strings are anagrams of each other; otherwise, print False
.
inputFormat
The input consists of two lines. The first line contains the first string, and the second line contains the second string.
outputFormat
Output a single line: 'True' if the two strings are anagrams of each other after ignoring spaces and case, otherwise 'False'.## sample
Listen
Silent
True
</p>