#!/bin/bash

typeset -i res=0
read S
read T

s1=$( echo $S | cut -b  1 )
s2=$( echo $S | cut -b  2 )
s3=$( echo $S | cut -b  3 )
t1=$( echo $T | cut -b  1 )
t2=$( echo $T | cut -b  2 )
t3=$( echo $T | cut -b  3 )

if [[ $s1 == $t1 ]] ; then
        res=$(( $res + 1 ))
fi
if [[ $s2 == $t2 ]] ; then
        res=$(( $res + 1 ))
fi
if [[ $s3 == $t3 ]] ; then
        res=$(( $res + 1 ))
fi

echo $res
