while True: try: s1 = input() s2 = input() if len(s1) > len(s2): s1,s2 = s2,s1 res = [] opt = '' for i in range(len(s1)): for j in range(i+1,len(s1)+1): if s1[i:j] in s2: res.append(s1[...