import hashlib import itertools import sys line = sys.stdin.read().strip() it = iter(itertools.count(1)) answer_1 = next( i for i in it if hashlib.md5(f"{line}{i}".encode()).hexdigest().startswith("00000") ) print(f"answer 1 is {answer_1}") answer_2 = next( i for i in it if hashlib.md5(f"{line}{i}".encode()).hexdigest().startswith("000000") ) print(f"answer 2 is {answer_2}")