Created
March 3, 2014 05:30
-
-
Save CaraCara/9318952 to your computer and use it in GitHub Desktop.
Reddit - Daily Programmer - [02-24-14] Challenge #149 [Easy] Disemvoweler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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