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