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)

Prompt: Below is an instruction that describes a task. Write a response that appropriately completes the request.

### 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)