Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Anagram
- def is_anagram(str1, str2):
- str3 = ''
- for char in str1:
- str3 += char
- for i in range(len(str2)):
- str3 = str3.replace(str2[i],'')
- return len(str3) == 0
- #Main Program
- str1 = input("Enter first string: ")
- str2 = input("Enter second string: ")
- if is_anagram(str1, str2):
- print("Strings \"%s\" and \"%s\" are anagram."%(str1, str2))
- else:
- print("Strings \"%s\" and \"%s\" are not anagram."%(str1, str2))
Advertisement
Add Comment
Please, Sign In to add comment