input: 
  def remove_duplicates(string: str) -> str:
      """ Remove all consecutive duplicates from the given string.
      >>> remove_duplicates("AAABBCCCD")
      'ABCD'
      """
  
output:     seen = string[0]
      result = string[0]
      for char in string[1:]:
          if char != seen:
              result += char
              seen = char
      return result