package me.yukicoder.lv1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No0345 { public static void main(String[] args) { try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { char[] array = br.readLine().toCharArray(); int ans = Integer.MAX_VALUE; for (int i = 0; i < array.length; i++) { if (array[i] == 'c') { // wwを探す int count = 0; for (int j = 0; j < array.length; j++) { if (array[j] == 'w') { count++; } if (count == 2) ans = Math.min(ans, j - i + 1); } } } System.out.println(ans); } catch (IOException e) { e.printStackTrace(); } } }