# Original string
text = "I'm not clumsy The floor just hates me"
# Step 1: Split the string into an array of words
# This turns the sentence into ["Ruby", "makes", "string", ...]
words = text.split
# Step 2: Pick a random index
# rand(words.length) returns a random number between 0 and words.length - 1
random_index = rand(words.length)
# Step 3: Remove the word at that index
# delete_at removes the element and returns it
removed_word = words.delete_at(random_index)
# Step 4: Join the remaining words back into a string
result = words.join(" ")
# Output results
puts "Original: #{text}"
puts "Removed word: #{removed_word}"
puts "Result: #{result}"
=begin
run
Original: I'm not clumsy The floor just hates me
Removed word: clumsy
Result: I'm not The floor just hates me
=end