TOPIC

60%wa ajuda

Manassés júlio da silva júnior asked 2 years ago

dic = {}

entrada = int(input()) if entrada >= 1 and entrada <= 50:

for x in range(entrada):
    a,b = [str(y) for y in input().split()]
    dic[a] = b

while True:
    entrada2 = int(input())
    if entrada2 == 0:
        break
    soma = 0

    for j in range(entrada2):
        c,d = [str(e) for e in input().split()]
        if c not in dic:
            dic[c] = d
            soma += 1
        else:
            q = 0
            k = 0
            v = str(dic[c])
            while q < len(d):
                if v[q] !=  d[q]:
                    k +=1
                q += 1
            if 1 > k:
                soma += 1

    if soma != 0:            
        print(soma)

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.