read a
read b
cnt=0
a1=`echo $a | cut -c 1`
a2=`echo $a | cut -c 2`
a3=`echo $a | cut -c 3`
b1=`echo $b | cut -c 1`
b2=`echo $b | cut -c 2`
b3=`echo $b | cut -c 3`


if [ $a1 = $b1 ];then
 cnt=$((cnt+1))
fi

if [ $a2 = $b2 ];then
 cnt=$((cnt+1))
fi

if [ $a3 = $b3 ];then
 cnt=$((cnt+1))
fi

echo $cnt