S = input() print(min(S.count('w'), S.count('c') - 1))