#C14620. Anagram Checker
Anagram Checker
Anagram Checker
Given two strings, determine whether they are anagrams of each other. Two strings are anagrams if they contain the same characters in the same quantity, but arranged in a different order. The solution should consider all characters and be case-sensitive.
For example, the strings "listen" and "silent" are anagrams, while "listen" and "silents" are not.
The problem requires the solution to read two lines of input from stdin
, where each line is one of the strings, and output either True
or False
to stdout
following the rules described above.
In mathematical terms, let \( s_1 \) and \( s_2 \) be two strings. Define the function \( f(s) \) to be the frequency count of each character in \( s \). The strings are anagrams if and only if \[ f(s_1)= f(s_2). \]
inputFormat
The input consists of two lines. The first line contains the first string \( s_1 \) and the second line contains the second string \( s_2 \). Both strings may include any characters.
outputFormat
Output a single line with either True
or False
depending on whether the two strings are anagrams.
listen
silent
True