input: from typing import List, Tuple
  
  
  def lcs(X: str, Y: str) -> int:
      """
      Finds the length of the longest common subsequence (LCS) between two strings.
  
      Example:
      >>> lcs("ABACEDF", "ABDCF")
      4
      >>> lcs("XMJYAUZ", "MZJAWXU")
      4
      """
      m = len(X)
      n = len(Y)
  
      L = [[None] * (n + 1) for i in range(m + 1)]
  
      for i in range(m + 1):
          for j in range(n + 1):
              if i == 0 or j == 0:
                  L[i][j] = 0
              elif X[i - 1] == Y[j - 1]:
                  L[i][j] = L[i - 1][j - 1] + 1
              else:
                  L[i][j] = max(L[i - 1][j], L[i][j - 1])
  
      return L[m][n]
  
  # Driver program
  X = "ABACEDF"
  Y = "ABDCF"
  
  print("Length of LCS is ", lcs(X, Y))
  
output:     
      m = len(X)
      n = len(Y)
  
      L = [[None] * (n + 1) for i in range(m + 1)]
  
      for i in range(m + 1):
          for j in range(n + 1):
              if i == 0 or j == 0:
                  L[i][j] = 0
              elif X[i - 1] == Y[j - 1]:
                  L[i][j] = L[i - 1][j - 1] + 1
              else:
                  L[i][j] = max(L[i - 1][j], L[i][j - 1])
  
      return L[m][n]
  