import scala.io.StdIn.readLine

object Main extends App {
  val s = readLine.toCharArray
  val t = readLine.toCharArray

  val res = s.zip(t)
  val ans = res.count(kv => kv._1 == kv._2)

  println(ans)
}