import java.util.*; import java.io.*; import java.awt.geom.*; import java.math.*; public class No0345 { static final Scanner in = new Scanner(System.in); static final PrintWriter out = new PrintWriter(System.out,false); static boolean debug = false; static void solve() { String s = in.next(); int n = s.length(); int w = 0; int x = -1; int max = -1; for (int i=n-1; i>=0; i--) { if (s.charAt(i) == 'w') { if (w == 0) x = i; w++; } if (w > 1 && s.charAt(i) == 'c') { max = x - i + 1; } } out.println(max); } public static void main(String[] args) { debug = args.length > 0; long start = System.currentTimeMillis(); solve(); out.flush(); long end = System.currentTimeMillis(); dump((end-start) + "ms"); in.close(); out.close(); } static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); } }