import java.util.*; import java.util.regex.*; public class A{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); String s=sc.next(); int c=a(s,"c"); int w=a(s,"w"); if(c>=w+1){ System.out.print(w); }else{ System.out.print(c-1); } } public static int a(String s,String c){ int count=0; Pattern p = Pattern.compile(c); Matcher m = p.matcher(s); while(m.find()){ count++; } return count; } }