str = gets.chomp t = (0..str.length).to_a.map{|i|(str.slice(i..str.length).scan(/^c.*?w.*?w/).first || "").length}.max p (t>0 ? t : -1)