-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckPermutation.py
More file actions
32 lines (25 loc) · 868 Bytes
/
CheckPermutation.py
File metadata and controls
32 lines (25 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Problem Statement
# For a given two strings, 'str1' and 'str2', check whether they are a permutation of each other or not.
# Permutations of each other
# Two strings are said to be a permutation of each other when either of the string's characters can be rearranged so that it becomes identical to the other one.
# Example:
# str1 = 'sinrtg'
# str2 = 'string'
# The character of the first string(str1) can be rearranged to form str2 and hence we can say that the given strings are a permutation of each other.
from os import *
from sys import *
from collections import *
from math import *
def isPermutation(string1, string2) :
if sorted(string1) == sorted(string2):
return True
else:
return False
#main
string1 = input()
string2 = input()
ans = isPermutation(string1, string2)
if ans :
print('true')
else :
print('false')