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