N1 = eval(input())

N2 = eval(input())

count = 0

for i in range(len(N1)):

    if N1[i] == N2[i]:

        count += 1

print(count)

S = eval(input())

T = eval(input())

ans = 0

for i in range(3):

  if S[i] == T[i]:

    ans += 1



print(ans)

N1 = eval(input())
N2 = eval(input())
count = 0
for i in range(len(N1)):
    if N1[i] == N2[i]:
        count += 1
print(count)

S = eval(input())
T = eval(input())
ans = 0
for i in range(3):
    if S[i] == T[i]:
        ans += 1
print(ans)

-N1 = eval(input()) -N2 = eval(input()) -count = 0 -for i in range(len(N1)): -    if N1[i] == N2[i]: -        count += 1 -print(count) +S = eval(input()) +T = eval(input()) +ans = 0 +for i in range(3): +    if S[i] == T[i]: +        ans += 1 +print(ans)