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