#include <iostream>
using namespace std;
int main() {
string s;
int total = 0;
cin >> s;
for (int i = 0; i < s.length(); i++){
if (i%3 == 0 && s[i] != 'P')
total++;
if (i%3 == 1 && s[i] != 'E')
total++;
if (i%3 == 2 && s[i] != 'R')
total++;
}
cout << total;
return 0;
}