package yukicode; import java.util.Scanner; public class chiwawa { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String input = scanner.nextLine(); String[] s_array = input.split(""); int cwwArray[] = new int[3]; for (int i = 0; i < s_array.length; i++) { if (s_array[i].equals("c") && cwwArray[2] == 0) { cwwArray[0] = i; } else if (s_array[i].equals("w") && cwwArray[1] == 0) { cwwArray[1] = i; } else if (s_array[i].equals("w") && cwwArray[2] == 0) { cwwArray[2] = i; } } if (cwwArray[2] == 0) { System.out.println(-1); } else { System.out.println(cwwArray[2] - cwwArray[0] + 1); } scanner.close(); } }