from collections import Counter

s = input().rstrip()

L = len(s)

d = Counter(s)

print((L//2-d["p"]))
s = input().rstrip()

print((len(s)//2-s.count("p")))
from collections import Counter

s = input().rstrip()
L = len(s)
d = Counter(s)
print((L // 2 - d["p"]))

s = input().rstrip()
print((len(s) // 2 - s.count("p")))

-from collections import Counter - -L = len(s) -d = Counter(s) -print((L // 2 - d["p"])) +print((len(s) // 2 - s.count("p")))