open Scanf;;
open Printf;;

let () =
  let s = read_line () in
  let t = read_line () in
  let ans = ref 0 in
  for i = 0 to String.length s - 1 do
    if s.[i] = t.[i] then incr ans;
  done;
  printf "%d\n" (!ans);
