a = gets.chomp b = a.match(/c.?w.*w/) if b == nil puts "-1" else puts b[0].size end