import java.util.Scanner; public class yukicoder_345 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); String str1 = stdIn.next(); int mojisu = -1; int c = str1.indexOf("c"); if (c != -1) { String str2 = str1.substring(c + 1); int w1 = str2.indexOf("w"); if (w1 != -1) { String str3 = str2.substring(w1 + 1); int w2 = str3.indexOf("w"); if(w2 != -1) { String moji = str1.substring(c, c + 1) + str2.substring(0, w1 + 1) + str3.substring(0, w2 + 1); mojisu = moji.length(); } } } System.out.println(mojisu); } }