import Control.Applicative ((<$>), (<*>), (<*), (*>), (<$))
import Control.Monad
import Data.List

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

solve :: String -> Int
solve s = p2 - p1
  where
    n = length s
    p1 = length $ filter (== 'p') s
    p2 = n `div` 2
