# Arup Guha
# 12/14/2024
# Solution to Kattis Problem: Cryptographer's Conundrum

# Getinput
word = input().strip()

# Store answer here.
res = 0

# Go through letters.
for i in range(len(word)):

    # Three rules for checking for changes.
    if i%3 == 0 and word[i] != 'P':
        res += 1
    if i%3 == 1 and word[i] != 'E':
        res += 1
    if i%3 == 2 and word[i] != 'R':
        res += 1

# Ta da!
print(res)
