import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.PriorityQueue; import java.util.Scanner; import java.util.Set; import java.util.TreeSet; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int c_count = 0, w_count = 0; for(final char ch : sc.next().toCharArray()){ if(ch == 'c'){ c_count++; }else{ w_count++; } } System.out.println(Math.min(c_count - 1, w_count)); } }