while true
    str = gets.chomp 
    break if str == "END OF INPUT"
    str += " "
    while str != ""
        index = str.index(" ")
        print index
        str = str[index + 1 .. -1]
    end
    puts
end
