s = gets.chomp a = s.scan(/c.*w.*w/) p a.empty? ? -1 : a.first.size