[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let s = (read string).ToCharArray()
    let t = (read string).ToCharArray()
    Array.zip s t
    |> Array.fold (fun s (a, b) -> if a = b then s + 1 else s) 0
    |> printfn "%i"
    0