Match or not-2



Problem to find the two names are match or not.(case insensitive)



Example-1:


Input    : s1 = "Mahendra Singh Dhoni"  s2 = "m s dhoni"
Output   : Match 


Example-2:


Input    : s1 = "Abraham Benjamin de Villiers"  s2 = "A B De Villiers"
Output   : Match   


Example-3:


Input    : s1 = "Virat Kohli"  s2 = "A Kohli"
Output   : Not Match   







Solution




s1 = "Mahendra Singh Dhoni".lower()

s2 = "m s dhoni".lower()

l1 = s1.split(" ")

l2 = s2.split(" ")

k = 0

for i in range(len(l1)):

    if(l1[i][0] == l2[i] or l1[i] == l2[i]):

        k += 1

if(k == len(l1)):

    print("Match")

else:

    print("Not Match")



Output



Match