import java.util.Scanner; public class Main{ private static Scanner sc=new Scanner(System.in); public static void main(String args[])throws Exception{ String s=sc.nextLine(); s=s.substring(s.lastIndexOf('c'),s.lastIndexOf('w')+1); if(s.lastIndexOf('w') == s.indexOf('w')){ System.out.println(-1); }else{ System.out.println(s.length()); } } }