Professional Documents
Culture Documents
Objective: To apply algorithms to solve the given problem and implement a modular program using
a method for solving the problem.
Program Code:
list1=list()
for i in str1:
list1.append(i)
list2=list()
for i in str2:
list2.append(i)
list1.sort()
list2.sort()
#checking if the lists are equal; if equal, they are anagrams, else not
if(list1==list2):
print ("Yes")
else:
print ("No")
N = int(input())
for i in range(N):
ip=input()
input_list.append(ip)
print("Output:")
for i in input_list:
lst = i.split()
isAnagram(lst[0], lst[1])
Sample Output: