Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def translate(word)
- if word[0] == ('a' || 'e' || 'i' || 'o' || 'u')
- result = word + "ay"
- elsif word[0..1] == "qu"
- result = word[2..-1] + word[0..1] + "ay"
- else
- vowel_position = 0
- found = false
- word.length.times do |x|
- if (['a', 'e', 'i', 'o', 'u'].include? word[x]) && (found == false)
- vowel_position = x
- found = true
- end
- end
- result = word[vowel_position..-1] + word[0..vowel_position-1] + "ay"
- end
- end
Add Comment
Please, Sign In to add comment