re: Find longest word in a given string VIEW POST

FULL DISCUSSION
 

Ignoring punctuation and only considering spaces... ruby solution:

def longest_word(str)
  str.split(/\s+/).max_by(&:length)
end
code of conduct - report abuse