
import java.util.Scanner



object Main {

  def read(): (String, String) = {
    val sc: Scanner = new Scanner(System.in)
    val s = sc.next
    val t = sc.next
    sc.close()
    (s, t)
  }


  def solve(s: String, t: String): Int = {
    var cnt = 0
    for(i <- 0 until s.length) {
      if(s(i) == t(i)) cnt += 1
    }
    cnt
  }


  def main(args: Array[String]): Unit = {
    val (s, t) = read()
    println(solve(s, t))
  }

}
