Match or not-1
Problem to find the two names are match or not. The special character("Mr.","Mrs.","Ms.","Shri.") does not matter.
Example-1:
Input : s1 = "crazy" s2 = "Mr.crazy" Output : Match
Example-2:
Input : s1 = "Natasha" s2 = "Ms.Natasha" Output : Match
Example-3:
Input : s1 = "Edison" s2 = "Mr.Tesla" Output : Not Match
Solution
s1 = "crazy" s2 = "Mr.crazy" if("." in s1): a = s1.split(".") s1 = a[-1] if("." in s2): a1 = s2.split(".") s2 = a1[-1] if(s1.casefold() == s2.casefold()): print("Match") else: print("Not Match")
Output
Match