Created
October 30, 2019 03:20
-
-
Save mark-d-holmberg/9c26de37b0666204ceb6951323eb1faf to your computer and use it in GitHub Desktop.
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
# Number 1 | |
input = %w[therapy fun is] | |
string = 'therapyisfunfunfunfunis' | |
input.each { |k| string.gsub!(k, " #{k} ") } | |
string.split.join(' ') | |
# Number 2 | |
# Same solution as 1 | |
input = %w[hello world good bye] | |
string = 'worldgoodgoodbye' | |
input.each { |k| string.gsub!(k, " #{k} ") } | |
string.split.join(' ') | |
# Number 3, even possible? | |
input = %w[foo bar baz the therapy] | |
string = "oofrabzabtherapy" | |
# Produce the output of | |
"oofrabzab therapy" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment