import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No00000345_Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { String s = br.readLine(); int cnt = 0; int step = 0; for(int i = 0; i < s.length(); i++) { char c = s.charAt(i); if(step != 0) cnt++; if(c == 'c') { if(step == 0) { step++; cnt++; } else { cnt = -1; break; } } else if(c == 'w') { if(step == 1) { step++; } else if(step == 2) { break; } } } System.out.println(cnt); } }