def readInput():
    input = open("day02_input.txt", "r")
    ids = []
    for line in input:
        ids.append(line.strip())
    return ids

def computeChecksum(ids):
    numberOfTwos = 0
    numberOfThrees = 0

    for id in ids:
        scanResult = scanId(id)
        if (scanResult[0]):
            numberOfTwos += 1
        if (scanResult[1]):
            numberOfThrees += 1

    return numberOfTwos * numberOfThrees

def scanId(id):
    occurenceOfChars = dict()
    for c in id:
        if not c in occurenceOfChars:
            occurenceOfChars[c] = 1
        else:
            occurenceOfChars[c] += 1
    hasTwos = any(v == 2 for v in occurenceOfChars.values())
    hasThrees = any(v == 3 for v in occurenceOfChars.values())
    return (hasTwos, hasThrees)

ids = readInput()
checksum = computeChecksum(ids)
print(checksum)
3715496c8a4fe1cdf1d9d532799dfc028cf93c8b
def readInput():
    input = open('day02_input.txt', 'r')
    ids = []
    for line in input:
        ids.append(line.strip())
    return ids


def computeChecksum(ids):
    numberOfTwos = 0
    numberOfThrees = 0
    for id in ids:
        scanResult = scanId(id)
        if scanResult[0]:
            numberOfTwos += 1
        if scanResult[1]:
            numberOfThrees += 1
    return numberOfTwos * numberOfThrees


<mask token>

def readInput():
    input = open('day02_input.txt', 'r')
    ids = []
    for line in input:
        ids.append(line.strip())
    return ids


def computeChecksum(ids):
    numberOfTwos = 0
    numberOfThrees = 0
    for id in ids:
        scanResult = scanId(id)
        if scanResult[0]:
            numberOfTwos += 1
        if scanResult[1]:
            numberOfThrees += 1
    return numberOfTwos * numberOfThrees


def scanId(id):
    occurenceOfChars = dict()
    for c in id:
        if not c in occurenceOfChars:
            occurenceOfChars[c] = 1
        else:
            occurenceOfChars[c] += 1
    hasTwos = any(v == 2 for v in occurenceOfChars.values())
    hasThrees = any(v == 3 for v in occurenceOfChars.values())
    return hasTwos, hasThrees


<mask token>

def readInput():
    input = open('day02_input.txt', 'r')
    ids = []
    for line in input:
        ids.append(line.strip())
    return ids


def computeChecksum(ids):
    numberOfTwos = 0
    numberOfThrees = 0
    for id in ids:
        scanResult = scanId(id)
        if scanResult[0]:
            numberOfTwos += 1
        if scanResult[1]:
            numberOfThrees += 1
    return numberOfTwos * numberOfThrees


def scanId(id):
    occurenceOfChars = dict()
    for c in id:
        if not c in occurenceOfChars:
            occurenceOfChars[c] = 1
        else:
            occurenceOfChars[c] += 1
    hasTwos = any(v == 2 for v in occurenceOfChars.values())
    hasThrees = any(v == 3 for v in occurenceOfChars.values())
    return hasTwos, hasThrees


<mask token>
print(checksum)

def readInput():
    input = open('day02_input.txt', 'r')
    ids = []
    for line in input:
        ids.append(line.strip())
    return ids


def computeChecksum(ids):
    numberOfTwos = 0
    numberOfThrees = 0
    for id in ids:
        scanResult = scanId(id)
        if scanResult[0]:
            numberOfTwos += 1
        if scanResult[1]:
            numberOfThrees += 1
    return numberOfTwos * numberOfThrees


def scanId(id):
    occurenceOfChars = dict()
    for c in id:
        if not c in occurenceOfChars:
            occurenceOfChars[c] = 1
        else:
            occurenceOfChars[c] += 1
    hasTwos = any(v == 2 for v in occurenceOfChars.values())
    hasThrees = any(v == 3 for v in occurenceOfChars.values())
    return hasTwos, hasThrees


ids = readInput()
checksum = computeChecksum(ids)
print(checksum)

def readInput():
    input = open("day02_input.txt", "r")
    ids = []
    for line in input:
        ids.append(line.strip())
    return ids

def computeChecksum(ids):
    numberOfTwos = 0
    numberOfThrees = 0

    for id in ids:
        scanResult = scanId(id)
        if (scanResult[0]):
            numberOfTwos += 1
        if (scanResult[1]):
            numberOfThrees += 1

    return numberOfTwos * numberOfThrees

def scanId(id):
    occurenceOfChars = dict()
    for c in id:
        if not c in occurenceOfChars:
            occurenceOfChars[c] = 1
        else:
            occurenceOfChars[c] += 1
    hasTwos = any(v == 2 for v in occurenceOfChars.values())
    hasThrees = any(v == 3 for v in occurenceOfChars.values())
    return (hasTwos, hasThrees)

ids = readInput()
checksum = computeChecksum(ids)
print(checksum)