import Control.Applicative
import Control.Monad
import Data.Array
import Data.Array.ST
import Data.Char
import Data.List
import qualified Data.Map as M
import qualified Data.Set as S
import Text.Printf

readInts :: IO [Int]
readInts = map read . words <$> getLine

main :: IO ()
main = do
  w <- getLine
  s <- getContents
  print $ count w s

count :: String -> String -> Int
count w = length . filter (== (map toLower w)) . words . map toLower

