def longestCommonSubstring(self, A, B): # write your code here if A == ‘‘ or B == ‘‘: return 0 if len(A) >= len(B): L, L1 = A[:], B[:] else: L, L1 = B[:], A[:] L = [L[i:j] for i in range(len(L)) for j in range(1, len(L)+1) if i < j] return max([len(i) for i in L if i in L1])