import java.util.Scanner; public class Main { static final int INF = Integer.MAX_VALUE; public static void main(String[] args) { Scanner sc = new Scanner(System.in); String a = sc.next(); int n = a.length(); int ans = -1; for(int i = 0 ; i < n ; i++) { for(int j = i + 1 ; j < n ; j++) { for(int k = j + 1 ; k < n ; k++) { if(a.charAt(i) == 'c' && a.charAt(j) == 'w' && a.charAt(k) == 'w') { ans = Math.min(ans, k - i + 1); } } } } if(ans == INF) { System.out.println(-1); } else { System.out.println(ans); } } }