Python3 代码
while True:
n = int(input())
if n == 0:
break
s = [""] * 200
s_len = n
mlen = 200
ms = ""
for i in range (n):
s[i] = input()
if mlen > len(s[i]):
mlen = len(s[i])
ms = s[i]
found = False
for j in range (mlen):
is_success = True
ms2 = ms[j:]
for k in range (s_len):
if s[k][len(s[k]) - mlen + j:] != ms2:
is_success = False
if is_success:
found = True
print (ms2)
break
if not found:
print ("")