fun main(arr:Array<String>) {
    val pattern = readLine()!!
    val paCount = pattern.count{ it == 'p'}
    val guCount = pattern.length - paCount
    val ans = (guCount - paCount) / 2
    println(ans)

}

