input: Write a function to find and return the longest string from a given list of strings. If there are multiple strings with the same maximum length, return the first one encountered.
  longest_string=['foo', 'test', 'longstring', 'bar']
  assert longest_string(longest_string)=='longstring'
  assert longest_string(['a', 'bb', 'ccc', 'dd'])=='ccc'
  assert longest_string([])==''
  assert longest_string(['same', 'same', 'short'])=='same'
output: def longest_string(strings):
      if not strings:
          return ''
      longest = strings[0]
      for s in strings:
          if len(s) > len(longest):
              longest = s
      return longest