import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int ans = 1001001001; for(int i = 0 ; i < s.length() ; i++) { int w = 0; for(int j = i + 1 ; j < s.length() ; j++) { if(s.charAt(i) == 'c' && s.charAt(j) == 'w') { w++; if(w == 2) { ans = j - i + 1; } } } } System.out.println(ans == 1001001001 ? -1 : ans); } }