fun main(args: Array<String>){
  val forecast = readLine() ?: "null"
  val weather = readLine() ?: "null"

  var count = 0
  for(i in 0..2)
    if( forecast[i] == weather[i] )
      count++

  println(count)
}
