from lib import * data = open(0).read().strip() second = True p = "" for row in zip(*data.splitlines()): counts = {} for l in LETTERS_LOWER: counts[l] = row.count(l) maxc = 0 minc = 999 c = "" for l, count in counts.items(): if second: if count > 0 and count < minc: minc = count c = l else: if count > maxc: maxc = count c = l p += c print(p)