let s = read_line ()
let t = read_line ()

let tenki s t = 
  let rec tenki_iter i ret = 
    if i = 3 then print_int ret
    else if s.[i] = t.[i] then tenki_iter (i+1) (ret+1)
    else tenki_iter (i+1) 1
  in tenki_iter 0 0