object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val s, t = sc.next
    sc.close()

    var ans = 0
    s.zipWithIndex.foreach {
      case (e: Char, i: Int) => if (t(i) == e) ans += 1
    }
    println(ans)
  }
}