{-# LANGUAGE TypeApplications #-}

import           Control.Monad
import           Control.Applicative
import           Data.List
import           Data.Char
import           Control.Arrow
import           Data.Bits


main = do
  s <- getLine
  t <- getLine
  print . length . filter (uncurry (==)) $ zip s t
