import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); int a =S.indexOf("c"); if(a==-1){ System.out.println(-1); }else{ S = S.substring(a); int b = S.indexOf("w"); String t = S.substring(b+1); int c = t.indexOf("w"); if(c==-1){ System.out.println(-1); }else{ System.out.println(b+c+2); } } } }