#K88507. Anagrams Checker
Anagrams Checker
Anagrams Checker
You are given two strings. Your task is to determine if the two strings are anagrams of each other. Two strings are considered anagrams if they consist of the same characters with the same frequencies, but possibly in a different order. In other words, given two strings \(s_1\) and \(s_2\), they are anagrams if and only if:
\( \text{count}_{s_1}(c) = \text{count}_{s_2}(c) \quad \forall c \in \text{charset}\)
The comparison is case-sensitive and white spaces (if any) are treated as ordinary characters. For example:
listen
andsilent
are anagrams.hello
andbillion
are not anagrams.
Your solution should read input from standard input and write the result to standard output.
inputFormat
The input consists of two lines:
- The first line contains the first string \(s_1\).
- The second line contains the second string \(s_2\).
outputFormat
Output a single line containing either True
if \(s_1\) and \(s_2\) are anagrams, or False
otherwise.
listen
silent
True