import java.util.*; import java.util.regex.*; public class Main { public static void main(String[] args) throws Exception { var sc = new Scanner(System.in); String line = sc.next(); var pattern = Pattern.compile("c.*w.*w"); var matcher = pattern.matcher(line); if(matcher.find()){ System.out.println(matcher.group().length()); }else{ System.out.println(-1); } } }