input: Write a function that, given an array of strings, identifies and returns the longest string. In cases where two or more strings have the same maximum length, return the first one encountered. If the input array is empty, return None.
  assert longest([]) == None
  assert longest(['x', 'y', 'z']) == 'x'
  assert longest(['x', 'yyy', 'zzzz', 'www', 'kkkk', 'abc']) == 'zzzz'
output: def longest(lst):
      if not lst:
          return None
      max_str = lst[0]
      for s in lst:
          if len(s) > len(max_str):
              max_str = s
      return max_str