import java.util.*; public class Exercise161 { public static void main(String[] args){ Scanner sc = new Scanner(System.in); String str = sc.next(); int cCount = str.lastIndexOf('c'); int total = str.length(); int wCount = total - (cCount + 1); System.out.println(Math.min(cCount, wCount)); } }