let () =
    let main () =
        let s = read_line () in
        let t = read_line () in
        let rec loop i acc =
            if i = 3 then acc else
                loop (i + 1) (acc + if s.[i] = t.[i] then 1 else 0)
        in
        let r = loop 0 0 in
        Printf.printf "%d\n" r
    in
    main ()