raw = """
##### ####   ###  ####  #####
#   # #   # #   # #   # #    
##### ####  #     #   # #### 
#   # #   # #   # #   # #    
#   # ####   ###  ####  #####
"""

raw_rows = raw.strip().split("\n")

def chunk_it(l, n): 
	return [l[i:i+n-1] for i in range(0, len(l), n)]

pixels = ["".join(l) for l in zip(*(chunk_it(l, 6) for l in raw_rows))]
# example: A --> "######   #######   ##   #"

numeric = [int(s.translate({ord("#"): "1", ord(" "): "0"}),2) for s in pixels]
# example: A --> 33095217


def base36encode(number):
    alphabet, base36 = ['0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', '']
    while number:
        number, i = divmod(number, 36)
        base36 = alphabet[i] + base36
    return base36 or alphabet[0]

codes = " ".join([base36encode(c) for c in numeric])
print(codes)
