#C3719. Check String Permutations
Check String Permutations
Check String Permutations
In this problem, you are given two strings and you need to determine whether one string is a permutation of the other. That is, if the characters of one string can be rearranged to form the other string. Formally, two strings s₁ and s₂ are permutations of each other if and only if (|s₁| = |s₂|) and for every character c, the frequency of c in s₁ equals the frequency of c in s₂.
Note that the comparison is case-sensitive and special characters are treated as ordinary characters. For example, "a!c@b#" is a permutation of "#b@c!a", but "Abc" is not a permutation of "cab" due to case differences.
Your task is to write a program that reads two strings from standard input and prints "True" if they are permutations of each other, and "False" otherwise.
inputFormat
The input consists of two lines. The first line contains the first string s₁ and the second line contains the second string s₂. Both strings can include alphanumeric characters, punctuation, and spaces.
outputFormat
Output a single line with either "True" or "False" (without quotes) indicating whether the two strings are permutations of each other.## sample
abc
cab
True