#include using namespace std; int dp[100][3];//n文字目から前の一番近い'c','w','w' int main(){ string s;cin>>s; if(s[0] == 'c')dp[0][0] = 1; else dp[0][0] = -1; dp[0][1] = -1; dp[0][2] = -1; for(int i = 1; s.size() > i; i++){ if(s[i] == 'c')dp[i][0] = 1; else if(dp[i-1][0] == -1)dp[i][0] = -1; else dp[i][0] = dp[i-1][0]+1; if(s[i] == 'w' && dp[i-1][0] != -1)dp[i][1] = dp[i-1][0]+1; else if(dp[i-1][1] == -1)dp[i][1] = -1; else dp[i][1] = dp[i-1][1]+1; if(s[i] == 'w' && dp[i-1][1] != -1)dp[i][2] = (dp[i-1][2] == -1 ? dp[i-1][1]+1 : min(dp[i-1][2],dp[i-1][1]+1)); else if(dp[i-1][2] == -1)dp[i][2] = -1; else dp[i][2] = dp[i-1][2]; } cout << dp[s.size()-1][2] << endl; }