import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.stream.Stream; 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 Ccounter = 0; int Wcounter = 0; for (int i = 0; i < S.length(); i++) { if (S.charAt(i) == 'c') { Ccounter += 1; } else { Wcounter += 1; } } if (Ccounter > Wcounter) { System.out.println(Wcounter); } else if (Ccounter < Wcounter) { System.out.println(Ccounter-1); } else { System.out.println(Ccounter-1); } } }