Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- d = {}
- best_c = ''
- best_x = 0
- def track_best(c):
- global best_c, best_x
- x = d[c]
- if x > best_x:
- best_c = c
- best_x = x
- def verify(line):
- keys = list(d.keys())[:]
- for c in keys:
- x = d[c] + 2
- while x > 0:
- if line.find(c * x) < 0:
- x -= 2
- if x < 0:
- del d[c]
- else:
- d[c] = x
- track_best(c)
- break
- for c in line:
- if c not in d:
- d[c] = 1
- track_best(c)
- for i in range(n):
- line = input()
- if i == 0:
- for c in line:
- if c not in d:
- d[c] = 1
- track_best(c)
- else:
- verify(line)
- [print(best_c * i) for i in range(1, best_x + 1, 2)]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement