import std.stdio, std.string, std.array, std.conv, std.algorithm, std.typecons, std.range, std.container, std.math, std.algorithm.searching, std.functional,std.mathspecial;

void main(){
    auto str=readln().chomp;
    writeln(str.length/2-str.count!(s=>s=='p'));
}