main :: IO ()
main = do
  str <- getLine
  print $ solve str

solve :: String -> Int
solve ss = (val `div` 2) - sum (map change ss)
  where
    val = length ss
    change :: Char -> Int
    change c
      | c == 'p' = 1
      | otherwise = 0
