#K50207. Rearrangement Check
Rearrangement Check
Rearrangement Check
Given two strings s1 and s2, determine whether s1 can be rearranged to form s2. In other words, check if the frequency of every character in s1 matches the frequency of every character in s2. Note that if the lengths of the two strings differ, the answer is immediately False
.
For example, the strings "listen" and "silent" can be rearranged into one another, while "hello" and "billion" cannot.
The task is to read the input from standard input (stdin) and output the result (True
or False
) to standard output (stdout). All outputs are case-sensitive.
inputFormat
The input consists of a single line containing two space-separated strings s1 and s2.
outputFormat
Output a single line: True
if s1 can be rearranged to form s2, otherwise False
.
listen silent
True