1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/env python3 import sys occ=[{} for _ in range(8)] for line in sys.stdin: for i in range(8): occ[i][line[i]]=occ[i].get(line[i],0)+1 for d in occ: mincount=1e300 minat=None for k in d: if d[k]<mincount: mincount=d[k] minat=k print(minat,end="") print()