行编辑行器
# include <stdio.h> # include <string.h> struct node { char a[300]; int top; }p; int main() { char s[1000]; int i,j,k,n; while(gets(s) != NULL) { p.top=0; n=strlen(s); for(i=0;i<n;i++) { if(s[i] != '#' && s[i] != '@') p.a[p.top++]=s[i]; else if(s[i]=='#') { if(p.top!=0) p.top--; } else if(s[i] == '@') p.top=0; } for(i=0;i<p.top;i++) printf("%c",p.a[i]); printf("\n"); } return 0; }