import java.util.*; public class Exercise31{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); String str = sc.next(); char[] charArray = str.toCharArray(); int min = charArray.length; boolean flag = false; for (int a = 0; a < charArray.length; a++){ if (charArray[a] == 'c'){ int w = 0; forW: for (int b = a + 1; b < charArray.length; b++){ if (charArray[b] == 'w'){ w++; } if (w == 2){ flag = true; min = Math.min(min, (b + 1) - a); break forW; } } } } if (flag){ System.out.println(min); }else{ System.out.println(-1); } } }