S = eval(input())

T = eval(input())



l = len(S)

res = 0

for n in range(l):

    if S[n] == T[n]:

        res += 1

print(res)
S = eval(input())

T = eval(input())

l = len(S)

ans = 0

for n in range(l):

    if S[n] == T[n]:

        ans += 1

print(ans)

S = eval(input())
T = eval(input())
l = len(S)
res = 0
for n in range(l):
    if S[n] == T[n]:
        res += 1
print(res)

S = eval(input())
T = eval(input())
l = len(S)
ans = 0
for n in range(l):
    if S[n] == T[n]:
        ans += 1
print(ans)

-res = 0 +ans = 0 -        res += 1 -print(res) +        ans += 1 +print(ans)