import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  s <- getLine
  t <- getLine
  print $ foldl (\acc i -> if s !! i == t !! i then acc + 1 else acc) 0 [0..((length s) - 1)] 
