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: maxcount=0 maxat=None for k in d: if d[k]>maxcount: maxcount=d[k] maxat=k print(maxat,end="") print()