input: def remove_duplicates(string: str) -> str:
      """ Remove all consecutive duplicate characters from the given string.
      >>> remove_duplicates("AAABBCCCD")
      'ABCD'
      >>> remove_duplicates("aabbccdd")
      'abcd'
      >>> remove_duplicates("a")
      'a'
      """
output:     result = []
      for i in range(len(string)):
          if i == 0 or string[i] != string[i-1]:
              result.append(string[i])
      return ''.join(result)