import sys
import hashlib as hashl
f1 = open("doc1.txt", "r+", encoding = 'utf-8')
f2 = open("doc2.txt", "r+", encoding = 'utf-8')
L = str(f1.read())
M = str(f2.read())
hd1 = hashl.md5(L.encode('utf-8'))
hd2 = hashl.md5(M.encode('utf-8'))
d = 0
test =str(hd1.hexdigest())[:2]
print(test)
while True:
    L = L + " " 
    hd2 = hashl.md5(L.encode('utf-8'))
    d+=1
    Y =  str(hd2.hexdigest())[:2] 
    if Y == test:
        print(d)
        break
