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