Guest User

ruby problem

a guest
Jul 13th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.25 KB | None | 0 0
  1. def vowel_indices(word)
  2.   vowels = %w[a e i o u y]
  3.   answer = []
  4.   word.downcase!
  5.   word.each_char do |c|    
  6.     if vowels.include?(c)
  7.       answer.push(word.index(c))
  8.     end
  9.   end
  10.   #answer.uniq!
  11.   answer.map! { |x| x + 1 }
  12.   return answer
  13. end
Advertisement
Add Comment
Please, Sign In to add comment