input: Write a python function to count the number of distinct substrings of a given string.
  assert count_distinct_substrings("abcd") == 10
  assert count_distinct_substrings("aaa") == 6
  assert count_distinct_substrings("abc") == 6
output: def count_distinct_substrings(s: str) -> int:
      n = len(s)
      substrings = set()
      for i in range(n):
          for j in range(i+1, n+1):
              substrings.add(s[i:j])
      return len(substrings)