Hacker News new | ask | show | jobs
by leephillips 839 days ago
The problem as stated does not have a unique solution in general, as you’ve found. One Julia program for this is

`sort(split(p)[count.(r"[aeiou]", split(p)) .< 3]; by=r -> length(r))[end]`

which also returns "grasp".

But this one appeals to me more, because it doesn’t split twice:

`sort(filter(w -> count(r"[aeiou]", w) < 3, split(p)); by=r -> length(r))[end]`