const stringList = require('fs').readFileSync('/dev/stdin','utf8').trim().split('\n')

var m = 0
for(var i in stringList[0]) {
  if(stringList[0][i] === stringList[1][i]) {
    m += 1
  }
}

console.log(m)
