"""
Day 6 of Advent of Code
Mohamed Lansari
"""
import operator

# primary code location
def main():
    # list of lines of transmissions
    lines = []

    # read the data file
    with open('info/day6info.txt', 'r') as f:
        for line in f:
            l = line.strip()
            lines.append(l)

    # iterate through each letter in the length of the first line
    letters = []
    for i in range(len(lines[0])):
        letterDict = {}
        # iterate through each line to count
        for line in lines:
            # put the letter in the dict
            if line[i] in letterDict.keys():
                letterDict[line[i]] += 1
            else:
                letterDict[line[i]] = 1

        # sort letterDict
        primesort = sorted(letterDict.items(), key=operator.itemgetter(0))
        # sort = sorted(primesort, key=operator.itemgetter(1), reverse=True)    # part 1
        sort = sorted(primesort, key=operator.itemgetter(1))                    # part 2
        letters.append(sort[0][0])

    # print out the final letters
    print(''.join(letters))

main()
1169183210d856ba06d03c5971adaa4a65c1dbcc
<mask token>

<mask token>


def main():
    lines = []
    with open('info/day6info.txt', 'r') as f:
        for line in f:
            l = line.strip()
            lines.append(l)
    letters = []
    for i in range(len(lines[0])):
        letterDict = {}
        for line in lines:
            if line[i] in letterDict.keys():
                letterDict[line[i]] += 1
            else:
                letterDict[line[i]] = 1
        primesort = sorted(letterDict.items(), key=operator.itemgetter(0))
        sort = sorted(primesort, key=operator.itemgetter(1))
        letters.append(sort[0][0])
    print(''.join(letters))


<mask token>

<mask token>


def main():
    lines = []
    with open('info/day6info.txt', 'r') as f:
        for line in f:
            l = line.strip()
            lines.append(l)
    letters = []
    for i in range(len(lines[0])):
        letterDict = {}
        for line in lines:
            if line[i] in letterDict.keys():
                letterDict[line[i]] += 1
            else:
                letterDict[line[i]] = 1
        primesort = sorted(letterDict.items(), key=operator.itemgetter(0))
        sort = sorted(primesort, key=operator.itemgetter(1))
        letters.append(sort[0][0])
    print(''.join(letters))


main()

<mask token>
import operator


def main():
    lines = []
    with open('info/day6info.txt', 'r') as f:
        for line in f:
            l = line.strip()
            lines.append(l)
    letters = []
    for i in range(len(lines[0])):
        letterDict = {}
        for line in lines:
            if line[i] in letterDict.keys():
                letterDict[line[i]] += 1
            else:
                letterDict[line[i]] = 1
        primesort = sorted(letterDict.items(), key=operator.itemgetter(0))
        sort = sorted(primesort, key=operator.itemgetter(1))
        letters.append(sort[0][0])
    print(''.join(letters))


main()

"""
Day 6 of Advent of Code
Mohamed Lansari
"""
import operator

# primary code location
def main():
    # list of lines of transmissions
    lines = []

    # read the data file
    with open('info/day6info.txt', 'r') as f:
        for line in f:
            l = line.strip()
            lines.append(l)

    # iterate through each letter in the length of the first line
    letters = []
    for i in range(len(lines[0])):
        letterDict = {}
        # iterate through each line to count
        for line in lines:
            # put the letter in the dict
            if line[i] in letterDict.keys():
                letterDict[line[i]] += 1
            else:
                letterDict[line[i]] = 1

        # sort letterDict
        primesort = sorted(letterDict.items(), key=operator.itemgetter(0))
        # sort = sorted(primesort, key=operator.itemgetter(1), reverse=True)    # part 1
        sort = sorted(primesort, key=operator.itemgetter(1))                    # part 2
        letters.append(sort[0][0])

    # print out the final letters
    print(''.join(letters))

main()