program main
  implicit none
  character(100000) :: s
  integer :: n, i, np
  read(*, *) s
  n = len(trim(s))
  np = 0
  do i = 1, n
    if (s(i:i) == "p") np = np + 1
  end do
  write(*, "(i0)") n / 2 - np
end program main
