How can I pass this code to object oriented programming in Python? n = int(input()) a = input().split() b = input().split() a.sort() b.sort() s = 0 for i in a: ans = 0 m = 0 for j in b: for k in...


How can I pass this code to object oriented programming in Python?


n = int(input())
a = input().split()
b = input().split()
a.sort()
b.sort()
s = 0


for i in a:
     ans = 0
     m = 0
     for j in b:
          for k in range(min(len(i), len(j))):
               if(i[k]!=j[k]):
                    break
               else:
                    ans += 1
          if(ans>m):
               m = ans
     s += m
print(s)



Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here