import itertools

import fractions

def main():

  s = eval(input())

  t = eval(input())

  cnt = 0

  for i in range(3):

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

      cnt += 1

  print(cnt)

if __name__ == '__main__':

  main()
s = eval(input())

t = eval(input())

ans = 0

for i in range(3):

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

        ans += 1

print(ans)

import itertools
import fractions


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


if __name__ == "__main__":
    main()

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

-import itertools -import fractions - - -def main(): -    s = eval(input()) -    t = eval(input()) -    cnt = 0 -    for i in range(3): -        if s[i] == t[i]: -            cnt += 1 -    print(cnt) - - -if __name__ == "__main__": -    main() +s = eval(input()) +t = eval(input()) +ans = 0 +for i in range(3): +    if s[i] == t[i]: +        ans += 1 +print(ans)