NYOJ2 括号配对问题
#include <stdio.h> char buf[10001]; int main(){ int t; char *p, ch; scanf("%d\n", &t); while(t--){ buf[0] = getchar(); p = buf + 1; while((ch = getchar()) != '\n'){ if(ch - 1 == *(p - 1) || ch - 2 == *(p - 1)) --p; else *p++ = ch; } printf(p == buf? "Yes\n": "No\n"); } return 0; }