import java.util.Scanner; public class No436 { static int search(String S,char c){ int cnt=0; for(char x:S.toCharArray()) { if(x==c) { cnt++;} } return cnt; } public static void main(String[]args) { Scanner sc = new Scanner(System.in); String S = sc.next(); int C,W; C = search(S,'c'); W = search(S,'w'); System.out.println(Math.min(C-1,W)); } }