Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CaraCara/9318952 to your computer and use it in GitHub Desktop.
Save CaraCara/9318952 to your computer and use it in GitHub Desktop.
Reddit - Daily Programmer - [02-24-14] Challenge #149 [Easy] Disemvoweler
puts "Please input the alpha characters to remove: " #Simply asking for input of letters to remove.
removals = gets.split('') #Gets the alpha characters, without any seperation, and splits them into an array.
#removals.pop #Input takes RETURN as character in array, pops off the stack.
puts removals #Showing nothing unusual.
puts "Please enter something to remove alpha character from: " #Asking for sentance 'block' of text to de alpha characterize.
block = gets #Block = Input
mutated = block.tr(removals.to_s, "") #Holding it after the array converted to a string, and replaced in block text.
puts mutated #Show me the money
finale = (block.split('') - mutated.split('')) #Compares the entered block, and the mutated block.
finale.delete(" ") #Delete spaces from array so we can have it nice and neat.
puts finale.join #Outputs the differences.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment