题目描述:https://pycoder.blog.csdn.net/article/details/124656685
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void)
{
char str[1000] = {0};
int stack_num = 0;
char stack[1000];
gets(str);
for (int i = 0; i < strlen(str); i++) {
if (stack_num == 0) {
stack[0] = str[i];
stack_num++;
} else {
if (str[i] == stack[stack_num - 1]) {
stack_num--;
} else {
stack[stack_num] = str[i];
stack_num++;
}
}
}
if (stack_num == 0) {
printf("YES\n");
} else {
printf("NO\n");
}
return 0;
}