S = gets.chomp counter = S.chars.tally if counter['c'] <= 1 puts 0 else puts [counter['c'] - 1, counter['w']].min end