-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnagrams.py
More file actions
56 lines (38 loc) · 946 Bytes
/
Copy pathAnagrams.py
File metadata and controls
56 lines (38 loc) · 946 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""
Given two strings as input, determine if they are anagrams or not. (Ignore the spaces, case and any punctuation or special characters).
Note: Anagrams are the strings which are made up of the same set of letters. For example : Mary and Army are anagrams.
Input Format
First line of the input contains the first string
Second line of the input contains the second string
Output Format
Print 'Yes' if the given strings are anagrams, 'No' otherwise.
Example:
Input:
Tom Marvolo Riddle
I am Lord Voldemort!!!
Output:
Yes
Input:
Royal Challengers Bangalore
Rajasthan Royals
Output:
No
"""
name=list(input())
name2=list(input())
a=""
b=""
for i in name:
if i.isupper():
a+=i.lower()
elif i.islower():
a+=i
for i in name2:
if i.isupper():
b+=i.lower()
elif i.islower():
b+=i
if sorted(a)==sorted(b):
print("Yes",end="")
else:
print("No",end="")