s=eval(input())

w=eval(input())



i=0

cnt=0

while i <len(s):

  if s[i]==w[i]:

    cnt+=1

  i+=1

  

print(cnt)

  
s=eval(input())

t=eval(input())

cnt=0

for i in range(3):

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

        cnt+=1



print(cnt)
s = eval(input())
w = eval(input())
i = 0
cnt = 0
while i < len(s):
    if s[i] == w[i]:
        cnt += 1
    i += 1
print(cnt)

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

-w = eval(input()) -i = 0 +t = eval(input()) -while i < len(s): -    if s[i] == w[i]: +for i in range(3): +    if s[i] == t[i]: -    i += 1