Last active
December 8, 2016 21:54
-
-
Save tracypholmes/53e538819a25619ead8b0b3b77c7a421 to your computer and use it in GitHub Desktop.
https://repl.it/ChPc/0 created by tracypholmes
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 "What code would you like to decrypt?" | |
string = gets.chomp | |
puts "Hi! I will solve " + string + " for you." | |
#0T2abr1za0c2aby | |
#0h2abe1zy | |
decode = string.split(/[0-9]/) | |
#puts decode | |
secret = decode.map { |i| i[-1]}.join | |
puts "Your code word is '" + secret + "' !" | |
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
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] | |
>>> What code would you like to decrypt? | |
0T2abr1za0c2aby | |
Hi! I will solve 0T2abr1za0c2aby for you. | |
T | |
abr | |
za | |
c | |
aby | |
Your code word is 'Tracy' ! | |
=> nil |
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
def decode(string) | |
string.split(/\d/).map{ |i| i[-1] }.join | |
end | |
# 0T2abr1za0c2aby | |
# 0h2abe1zy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment