def processPassport(passport):
    reqSplits=passport.split()
    if len(reqSplits) < 7 or len(reqSplits) > 8:
        return 0
    if len(reqSplits) == 8:
        return 1
    codeSet=set()
    for i in reqSplits:
        codeValue=i.split(':')
        codeSet.add(codeValue[0])
    if len(reqSplits) ==7 and 'cid' not in codeSet:
        return 1
    return 0
with open('/Users/master/projects/aoc/2020/04/input.txt') as f:
    lines=f.read().splitlines()
    currPassport=""
    validPassports=0
    for line in lines:
        if line == '':
            validPassports += processPassport(currPassport.strip())
            currPassport=""
            continue
        currPassport+= " " + line
    validPassports += processPassport(currPassport.strip())

print('valid passports ', validPassports)



    
9645c7d4a0f06727d6bf76f797d579d9e8578978
<mask token>

def processPassport(passport):
    reqSplits = passport.split()
    if len(reqSplits) < 7 or len(reqSplits) > 8:
        return 0
    if len(reqSplits) == 8:
        return 1
    codeSet = set()
    for i in reqSplits:
        codeValue = i.split(':')
        codeSet.add(codeValue[0])
    if len(reqSplits) == 7 and 'cid' not in codeSet:
        return 1
    return 0


<mask token>

def processPassport(passport):
    reqSplits = passport.split()
    if len(reqSplits) < 7 or len(reqSplits) > 8:
        return 0
    if len(reqSplits) == 8:
        return 1
    codeSet = set()
    for i in reqSplits:
        codeValue = i.split(':')
        codeSet.add(codeValue[0])
    if len(reqSplits) == 7 and 'cid' not in codeSet:
        return 1
    return 0


with open('/Users/master/projects/aoc/2020/04/input.txt') as f:
    lines = f.read().splitlines()
    currPassport = ''
    validPassports = 0
    for line in lines:
        if line == '':
            validPassports += processPassport(currPassport.strip())
            currPassport = ''
            continue
        currPassport += ' ' + line
    validPassports += processPassport(currPassport.strip())
print('valid passports ', validPassports)

def processPassport(passport):
    reqSplits=passport.split()
    if len(reqSplits) < 7 or len(reqSplits) > 8:
        return 0
    if len(reqSplits) == 8:
        return 1
    codeSet=set()
    for i in reqSplits:
        codeValue=i.split(':')
        codeSet.add(codeValue[0])
    if len(reqSplits) ==7 and 'cid' not in codeSet:
        return 1
    return 0
with open('/Users/master/projects/aoc/2020/04/input.txt') as f:
    lines=f.read().splitlines()
    currPassport=""
    validPassports=0
    for line in lines:
        if line == '':
            validPassports += processPassport(currPassport.strip())
            currPassport=""
            continue
        currPassport+= " " + line
    validPassports += processPassport(currPassport.strip())

print('valid passports ', validPassports)



    