Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def translate (words)
- vowels = ['a', 'e', 'i', 'o', 'u']
- last = "ay"
- consonants = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"]
- words = words.split
- words.each { |word|
- if vowels.include? word[0]
- word = word + last
- next
- end
- if consonants.include? word[0]
- word = word + word[0]
- word = word[1..-1]
- while consonants.include? word[0]
- word = word + word[0]
- word = word[1..-1]
- end
- word = word + last
- next
- end
- }
- words.join(' ')
- end
Advertisement
Add Comment
Please, Sign In to add comment