from collections import Counter s = input() counter = Counter(s) print(max(0, min(counter['c'] - 1, counter['w'])))