str = gets.chomp p (0..str.length).to_a.map{|i|(str.slice(i..str.length).scan(/^c.*?w.*?w/).first)}.select{|s|!s.nil?}.map{|s|s.length}.min || -1