Created
February 21, 2018 12:42
-
-
Save AJFaraday/4ecd30547f54b28c6e12eb3fd5dc47e8 to your computer and use it in GitHub Desktop.
vowel rotation
This file contains hidden or 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
s = "It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way – in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only." | |
vowels = %w{a e i o u} | |
vowels.each_with_index do |vowel, index| | |
s.gsub!(vowel,"SUB#{index}SUB") | |
end | |
vowels.each_with_index do |vowel, index| | |
s.gsub!("SUB#{index}SUB", vowels[(index+1)%vowels.length]) | |
end | |
puts s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment