import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int a, b, c, min = 1000; a = s.indexOf('c'); while(a >= 0){ b = s.indexOf('w', a); c = s.indexOf('w', b+1); min = Math.min(min, c-a+1); a = s.indexOf('c', a+1); } if(min < 1000){ System.out.println(min); } else { System.out.println(-1); } } }