#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>T; string X="good",Y="problem"; while(T--){ string s; cin>>s; Int n=s.size(); Int ans=11; for(Int i=0;i+11<=n;i++){ for(Int j=i+4;j+7<=n;j++){ Int res=0; for(Int k=0;k<4;k++) res+=s[i+k]!=X[k]; for(Int k=0;k<7;k++) res+=s[j+k]!=Y[k]; chmin(ans,res); } } cout<