import java.util.*

fun main(args: Array<String>) {
  val forecast = readLine()!!.split("").filter { it != "" }.toList()
  val actual = readLine()!!.split("").filter { it != "" }.toList();
  var match = 0
  
  forecast.forEachIndexed {i,e ->
    if (e == actual.get(i)) {
      match++
    }
  }
  println(match)
}
