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