str = gets.chomp count = Array.new(str.length, 0) (1 .. str.length).each do |i| j = i while str[j] == "w" && str[j+1] != nil && str[j+1] == "w" count[i-1] += 1 j += 1 end end puts count