fun main(args: Array<String>) {
    abc139a()
}

fun abc139a() {
    val s = readLine()!!.toCharArray()
    val t = readLine()!!.toCharArray()

    val answer = (0..2).filter {
        s[it] == t[it]
    }.count()

    println(answer)
}
