fork download
  1. def vowelhistagram(string)
  2. string.each_char.with_object(Hash.new(0)) {
  3. |obj, hsh| hsh[obj] += 1 if obj =~ /[aeiou]/i
  4. else
  5. if (obj =~ /[aeiou]/i).count <= 0
  6. hsh[obj] += 1
  7. end
  8. }
  9. end
  10.  
  11. print vowelhistagram("Alright well lets see if this works")
Runtime error #stdin #stdout #stderr 0.05s 9648KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.rb:4: syntax error, unexpected keyword_else, expecting '}'