#!/usr/bin/env python3 # XXX: This solution is totally not scalable, and could # EASILY use the solution to pt B for a faster solution. # I'm keeping it for posterity to show that I brute forced # pt A :) import sys fish = [] def repro(fish): new = [] for f in fish: if f == 0: new += [6, 8] else: new.append(f - 1) return new for l in sys.stdin: # just keep the last one (only one) fish = [int(x) for x in l.split(',')] for i in range(80): fish = repro(fish) print(len(fish))