import Control.Monad
import Control.Applicative
import Data.Char
solve :: String -> String
solve str =
    let w:ws = words $ map toLower str in
    show $ length [a | a<-ws, a==w]

main =
    putStrLn =<< solve <$> getContents 
