s,t=eval(input()),eval(input())

n=0

for x,y in zip(s,t):

    if x==y:

        n+=1

print(n)
s,t=eval(input()),eval(input())

count=0

for i in range(3):

    if s[i]==t[i]:

        count+=1



print(count)
s, t = eval(input()), eval(input())
n = 0
for x, y in zip(s, t):
    if x == y:
        n += 1
print(n)

s, t = eval(input()), eval(input())
count = 0
for i in range(3):
    if s[i] == t[i]:
        count += 1
print(count)

-n = 0 -for x, y in zip(s, t): -    if x == y: -        n += 1 -print(n) +count = 0 +for i in range(3): +    if s[i] == t[i]: +        count += 1 +print(count)