'use strict'

const main = (INPUT) => {
  const input = INPUT.split('\n')
  const S = input[0]
  const T = input[1]
  let ans = 0
  for (let i = 0; i < S.length; i++) {
    if (S[i] == T[i]) {
      ans++
    }
  }
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
