#C5792. Permutation Check
Permutation Check
Permutation Check
Given two strings, determine whether one string is a permutation of the other. Two strings are said to be permutations of each other if they contain exactly the same characters with the same frequencies, regardless of order. Note that the comparison is case-sensitive.
You can mathematically formulate the condition as follows: for two strings \(s_1\) and \(s_2\), they are permutations if and only if \[ \text{sorted}(s_1) = \text{sorted}(s_2), \] where \(\text{sorted}(s)\) denotes the string obtained by sorting the characters of \(s\) in non-decreasing order.
Your task is to write a program that reads two strings from standard input and outputs True
if they are permutations of each other and False
otherwise.
inputFormat
The input consists of exactly two lines. The first line contains the first string, and the second line contains the second string.
outputFormat
Print a single line: True
if the two strings are permutations of each other, otherwise False
.
abc
cab
True
</p>