input: 
  def generate_substrings(string: str) -> list:
      """Generate all substrings of a given string in order from longest to shortest length.
      >>> generate_substrings("abcd")
      ['abcd', 'bcd', 'cd', 'd', 'abc', 'bc', 'c', 'ab', 'b', 'a']
      >>> generate_substrings("xyz")
      ['xyz', 'yz', 'z', 'xy', 'y', 'x']
      """
      result = []
      n = len(string)
      for l in range(n, 0, -1):
          for i in range(n - l + 1):
              result.append(string[i:i + l])
      return result
  
output:     result = []
      n = len(string)
      for l in range(n, 0, -1):
          for i in range(n - l + 1):
              result.append(string[i:i + l])
      return result