class A{ public static void main(String[]$){ String c=new java.util.Scanner(System.in).next(); System.out.println(c.matches(".*c.*w.*w.*")?c.length()-c.replaceFirst("c.*?w.*?w","").length():-1); } }