#include <bits/stdc++.h>
using namespace std;

int main(){
	string s;
	cin>>s;
	int paper = 0;
	for(int i = 0; i < s.size(); ++i){
		if(s[i] == 'p')paper++;
	}
	cout<<(s.size() / 2) - paper<<endl;
	return 0;
}
