const p = console.log;
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

// [ 'CSS', 'CSR', '' ]
const a = input.split('\n');

const yohou = a[0].split('');
const kekka = a[1].split('');

let cnt = 0;

for(let i=0; i<yohou.length; i++){
    if(yohou[i] === kekka[i]){
        cnt++;
    }
}

p(cnt);
