input: Write a function to find the longest common subsequence between two strings and return it as a string. The function should take two string inputs and use dynamic programming to determine the longest sequence of characters that appear in both strings, in the same order. If there is no common subsequence, the function should return an empty string.
  
  def longest_common_subsequence(string1, string2):
      table = [[0]*(len(string2)+1) for _ in range(len(string1)+1)]
  
      for i, x in enumerate(string1):
          for j, y in enumerate(string2):
              if x == y:
                  table[i+1][j+1] = table[i][j]+1
              else:
                  table[i+1][j+1] = max(table[i+1][j], table[i][j+1])
  
      result = ""
      x, y = len(string1), len(string2)
      while x != 0 and y != 0:
          if table[x][y] == table[x-1][y]:
              x -= 1
          elif table[x][y] == table[x][y-1]:
              y -= 1
          else:
              result = string1[x-1] + result
              x -= 1
              y -= 1
      return result
  
  assert longest_common_subsequence("ABCDF", "ABECD") == "ABCD"
  assert longest_common_subsequence("XMJYAUZ", "MZJAWXU") == "MJAU"
  assert longest_common_subsequence("ABCDEFG", "DEFGABC") == "DEFG"
  assert longest_common_subsequence("GXTXAYB", "AGGTAB") == "GTAB"
  assert longest_common_subsequence("ABC", "DEF") == ""
output: def longest_common_subsequence(string1, string2):
      table = [[0]*(len(string2)+1) for _ in range(len(string1)+1)]
  
      for i, x in enumerate(string1):
          for j, y in enumerate(string2):
              if x == y:
                  table[i+1][j+1] = table[i][j]+1
              else:
                  table[i+1][j+1] = max(table[i+1][j], table[i][j+1])
  
      result = ""
      x, y = len(string1), len(string2)
      while x != 0 and y != 0:
          if table[x][y] == table[x-1][y]:
              x -= 1
          elif table[x][y] == table[x][y-1]:
              y -= 1
          else:
              result = string1[x-1] + result
              x -= 1
              y -= 1
      return result