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++; w = 0; indexC = i; } else if(s.charAt(i) == 'w') { w++; if(w == 2) { indexW = i; ans = Math.min(ans, indexW - indexC + 1); indexW = 0; indexC = 0; } } } System.out.println(-1); } }