>   2. Write a function to find the longest string in an array of  
> strings.
>
Is this from the Brian Schroder Ruby Course PDF?

Here is my function (no doubt a better on exists):

def longest(a)
   word = ''
   a.each do |i|
     if word.length < i.length
       word = i
     end
   end
   word
end


a = ['a', 'fish', 'is', 'messy', 'dog']

puts longest(a)