import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); String comp = S; int flag = 0; for(int i = 0; i < S.length(); i++) { if(S.substring(i, i + 1).equals("c")) { S = S.substring(i); comp = S; //System.out.println(S); S = S.substring(S.indexOf("w") + 1); //System.out.println(S); if(S.indexOf("w") == -1) { flag = 1; break; } else { S = S.substring(S.indexOf("w") + 1); //System.out.println(S); } } } if(flag == 0) { System.out.println(comp.length() - S.length()); } else { System.out.println(-1); } } }