import java.util.*


fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    var S: String
    S = sc.next()
    var T: String
    T = sc.next()
    solve(S, T)
}

fun solve(S: String, T: String) {
    var res = 0
    for (i in S.indices) {
        if (S[i] == T[i]) {
            res++
        }
    }
    println(res)
}

