import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int o = 0 ,p = 0,q = 0; long a = 0, b = 0, c = 0; char ch; String str; String s1 = sc.next(); char[] c1 = s1.toCharArray(); for(int i = 0; i < s1.length(); i++ ){ if( c1[i]=='c' ) p++; if( c1[i]=='w' ) q++; } if(p>q) System.out.print(q); if(q>=p) System.out.print(p-1); System.out.println(); } }