import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); int n = 0; boolean c = false; int wc = 0; for(String s : S.split("")) { if (c) n++; if (s.equals("c")) { n = 1; c = true; } if (s.equals("w")) { wc++; if (wc == 2) { break; } } } if (c && wc == 2) { System.out.println(n); } else { System.out.println("-1"); } } }