import java.util.Scanner; import java.util.ArrayList; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList ch = new ArrayList(); String str = sc.next(); for (char c : str.toCharArray()) ch.add(c); int n = -1; int cnt = 0; int size = 0; for (int i = 0; i < ch.size(); i++) { if (cnt == 3) break; switch (cnt) { case 0: if (ch.get(i) == 'c') { cnt++; size++; }; break; case 1: case 2: if (ch.get(i) == 'w') cnt++; size++; break; } } if (cnt == 3) System.out.printf("%d\n", size); else System.out.println("-1"); } }