input: Write a function to find and print the longest string in a given list of strings. If there are multiple strings with the same maximum length, the function should return the first one encountered in the list. If the given list is empty, the function should return an empty string.
  assert longest_string(['foo', 'test', 'longstring', 'bar'])=='longstring'
  assert longest_string(['short', 'longer', 'longest'])=='longest'
  assert longest_string(['cat', 'dog', 'bird'])=='bird'
  assert longest_string([])==''
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