# 2019-11-17 20:44:23(JST)

import sys

# import collections

# import math

# from string import ascii_lowercase, ascii_uppercase, digits

# from bisect import bisect_left as bi_l, bisect_right as bi_r

# import itertools

# from functools import reduce

# import operator as op

# import re

# import heapq

# import array

# from scipy.misc import comb # (default: exact=False)

# import numpy as np 





def main():

    s, t = sys.stdin.read().split()



    count = 0

    for i in range(3):

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

            count += 1

    print(count)





if __name__ == "__main__":

    main()

import sys



s, t = sys.stdin.read().split()



def main():

    cnt = 0

    for i in range(3):

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

            cnt += 1

    return cnt

    

if __name__ == '__main__':

    ans = main()

    print(ans)
# 2019-11-17 20:44:23(JST)
import sys

# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np
def main():
    s, t = sys.stdin.read().split()
    count = 0
    for i in range(3):
        if s[i] == t[i]:
            count += 1
    print(count)


if __name__ == "__main__":
    main()

import sys

s, t = sys.stdin.read().split()


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


if __name__ == "__main__":
    ans = main()
    print(ans)

-# 2019-11-17 20:44:23(JST) -# import collections -# import math -# from string import ascii_lowercase, ascii_uppercase, digits -# from bisect import bisect_left as bi_l, bisect_right as bi_r -# import itertools -# from functools import reduce -# import operator as op -# import re -# import heapq -# import array -# from scipy.misc import comb # (default: exact=False) -# import numpy as np +s, t = sys.stdin.read().split() + + -    s, t = sys.stdin.read().split() -    count = 0 +    cnt = 0 -            count += 1 -    print(count) +            cnt += 1 +    return cnt -    main() +    ans = main() +    print(ans)