s = input() ccnt = s.count('c') wcnt = s.count('w') print(min(ccnt-1, wcnt))