package yukicode; public class chiwawa { public static void main(String[] args) { String s = args[0]; String[] s_array = s.split(""); try { int cwwArray[] = new int[3]; for (int i = 0; i < s_array.length; i++) { if (s_array[i].equals("c") && cwwArray[1] == 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); } } catch (RuntimeException e) { System.out.println("エラー" + e); } } }