Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #aoc2016_6.py
- input_file_object = open("aoc16_input_6a.txt")
- input_as_string = input_file_object.read()
- input_file_object.close()
- input_separated = input_as_string.split('\n')
- cols = ['','','','','','','','']
- msg = ''
- def infrequent_char(text):
- charset = ''.join(sorted(text))
- mincount = len(text)
- minchar = None
- for item in charset.lower():
- charcount = text.count(item)
- if charcount < mincount :
- mincount = charcount
- minchar = item
- return minchar
- for i in range(len(input_separated)):
- for j in range(len(cols)):
- cols[j] += cols[j].join(input_separated[i][j])
- for x in range(len(cols)):
- res = infrequent_char(cols[x])
- msg += msg.join(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement