fun main(args: Array<String>) {
    val s = readLine()!!.split("").run {slice(1 until lastIndex)}
    val t = readLine()!!.split("").run {slice(1 until lastIndex)}

    println(s.withIndex().count {
        it.value == t[it.index]
    })
}