import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int a, b, c; a = s.indexOf("c"); if (a < 0) { System.out.println(-1); return; } b = s.indexOf("w", a + 1); if (b < 0) { System.out.println(-1); return; } c = s.indexOf("w", b + 1); if (c < 0) { System.out.println(-1); return; } System.out.println(c - a + 1); } }