open System
open System.Collections.Generic;

let S =stdin.ReadLine()
let T =stdin.ReadLine()
[<EntryPoint>]
let sf argv = 
    let mutable ans = 0
    for i in [0.. 2] do
        ans <- ans + if S.[i]=T.[i] then 1 else 0
    printf "%d" ans
    0
