input = gets.chomp size = input.size for i in 0..size-1 if input[i] == "c" x = i next end if input[i] == "w" y = i next end end if x < y puts y - x + 1 else puts -1 end