search_word = 'ccw' s = gets.chomp puts [s.count('c') - 1, s.count('w')].min