#include<stdio.h>
#include<string.h>


int main()
{
	char jd[10002];
	int length=0,sc=0,po=0;
	scanf("%s",jd);
	length=strlen(jd);
	if(length%2==0)
	{
		sc=length/2;
	}
	else
	{
		sc=(length-1)/2;
	}
	int counter;
	for(counter=0;counter<length;counter++)
	{
		if(jd[counter]=='p')
		{
			po++;
		}
	}
	int con;
	printf("%d",sc-po);
	
	
}