#include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define INF 1<<30 #define MP make_pair #define mp make_pair #define pb push_back #define PB push_back #define DEBUG(x) cout<<#x<<": "<>T; while(T--){ string s;cin>>s; int len = s.size(); REP(i,len+10){ NG[i] = (i) ? NG[i-1]:0; M[i] = 114514; if(i+6>=len) M[i] = 114514; else{ M[i]=0; REP(x,7) if(s[i+x]!="problem"[x]) M[i]++; if(M[i]==0) NG[i]++; } } int mini = 114514; RREP(i,len+1) M[i] = min(M[i],M[i+1]); REP(i,len-4){ int cnt=0; REP(x,4) if(s[i+x] != "good"[x]) cnt++; mini = min(mini,cnt+M[i+4]+((i>=7)? NG[i-7]:0)); } cout<