Write a function to validate if the provided two strings are anagrams or not. If the two strings are anagrams, then return ‘yes’. Otherwise, return ‘no’.
Input:
Input 1: 1st string
Input 2: 2nd string
Output:
(If they are anagrams, the function will return ‘yes’. Otherwise, it will return ‘no’.)
Example
Input 1: Listen
Input 2: Silent
Output:
Yes
Explanation
Listen and Silent are anagrams (an anagram is a word formed by rearranging the letters of the other word).
s=input()
t=input()
def checkAnagram(s,t):
sdict={}
tdict={}
for i in s:
if i in sdict:
sdict[i]+=1
else:
sdict[i]=1
for j in s:
if j in tdict:
tdict[j]+=1
else:
tdict[j]=1
if sdict==tdict:
return 'Yes'
else:
return 'No'
print(checkAnagram(s,t))