S = eval(input())

T = eval(input())

count = 0

for s,t in zip(S, T):

  if s == t:

    count += 1

    

print(count)

  
S = eval(input())

T = eval(input())



count = 0

if S[0] == T[0]:

  count += 1

if S[1] == T[1]:

  count += 1

if S[2] == T[2]:

  count += 1

print(count)
S = eval(input())
T = eval(input())
count = 0
for s, t in zip(S, T):
    if s == t:
        count += 1
print(count)

S = eval(input())
T = eval(input())
count = 0
if S[0] == T[0]:
    count += 1
if S[1] == T[1]:
    count += 1
if S[2] == T[2]:
    count += 1
print(count)

-for s, t in zip(S, T): -    if s == t: -        count += 1 +if S[0] == T[0]: +    count += 1 +if S[1] == T[1]: +    count += 1 +if S[2] == T[2]: +    count += 1