object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val s, t = sc.next

  def tenki(s: String, t: String): Int = {
    s.zip(t).filter(v => v._1 == v._2).size
  }

  println(tenki(s, t))
}