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

getsolve :: String -> Int
getsolve str = canPa - paCount
               where paCount = length $ filter (== 'p') str
                     canPa   = div (length str) 2

