import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String S = reader.readLine(); int wCount = 0; int firstW = 0; int secondW = 0; int answer = -1; for (int i = S.length() - 1; i >= 0; i--) { char current = S.charAt(i); if (current == 'w') { wCount += 1; if (wCount == 1) { firstW = i; } else if (wCount == 2) { secondW = i; } else { firstW = secondW; secondW = i; } // System.out.println("first ; " + firstW + " second; " + secondW); // } else if (current == 'c' && wCount >= 2) { // System.out.println("c; " + i + "first ; " + firstW + " second; " + secondW); answer = firstW - i + 1; } else if (current == 'c' && wCount < 2) { wCount = 0; } } System.out.println(answer); } }