input: Write a python function to generate all substrings of a given string.
  assert substrings("abc") == ['a', 'ab', 'abc', 'b', 'bc', 'c']
  assert substrings("abcd") == ['a', 'ab', 'abc', 'abcd', 'b', 'bc', 'bcd', 'c', 'cd', 'd']
  assert substrings("xy") == ['x', 'xy', 'y']
output: def substrings(s):
      result = []
      for i in range(len(s)):
          for j in range(i + 1, len(s) + 1):
              result.append(s[i:j])
      return result