input: Write a function to remove all the consecutive duplicates from a given string. If the given string is empty then return an empty string.
  def remove_duplicates(string):
      result = ""
      prev = ''
  
      for char in string:
          if char != prev:
              result += char
              prev = char
      return result
  
  assert remove_duplicates("AAABBCCCD") == "ABCD"
  assert remove_duplicates("abccba") == "abcba"
  assert remove_duplicates("a") == "a"
  assert remove_duplicates("aaa") == "a"
  assert remove_duplicates("") == ""
output: def remove_duplicates(string):
      result = ""
      prev = ''
  
      for char in string:
          if char != prev:
              result += char
              prev = char
      return result