#include <stdio.h>
#include <string.h>
int stack[100];
int top = -1;
void push(int x){
stack[++top] = x;
}
void pop(){
top--;
}
int main(){
char arr[] = "ABBCCDA";
for (int i = 0;i < 7;i++) {
if (stack[top] == arr[i]) {
pop();
}else{
push(arr[i]);
}
}
for (int i = 0; i <= top; i++) {
printf("%c", stack[i]);
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: