input: Write a function to remove all consecutive duplicate characters from a given string. If the given string is empty then return an empty string.
  assert remove_duplicates("AAABBCCCD")=="ABCD"
  assert remove_duplicates("ABC")=="ABC"
  assert remove_duplicates("AABBCC")=="ABC"
  assert remove_duplicates("")==""
  assert remove_duplicates("AAA")=="A"
  
  
  Let's break down the example you provided:
  
  ### Instruction:
  Generate a python script to perform this action.
  
  ### Input:
  Given a string, remove all the consecutive duplicates from the string.
  
  Input: "AAABBCCCD"
  
  ### Output:
  def remove_duplicates(string): 
      result = "" 
      prev = '' 
  
      for char in string:
          if char != prev: 
              result += char
              prev = char
      return result
  
  result = remove_duplicates("AAABBCCCD")
  print(result)
  
  This example clearly indicates the function’s intention and includes a clear header, as well as assertion tests to verify correctness.
output: def remove_duplicates(string): 
      result = "" 
      prev = '' 
  
      for char in string:
          if char != prev: 
              result += char
              prev = char
      return result