a = gets.chomp.split("") b = [] count = 0 a.length.times do |i| count += 1 if b.include?("c") if a[i] == "c" && b.empty? b.push("c") count += 1 elsif a[i] == "w" && b.include?("c") && b.count("w") < 2 b.push("w") end break if b.count("w") == 2 end puts b.count("w") == 2 ? count : -1