Data Structure Problem - palindrome using stack and queue to judge

Users questions:A judge read in turn to the letters @ the end of the symbol sequence, it is shaped like a 'sequence 1 & Series 2' mode of character sequence. In which the sequence 1 and sequence 2 are without character '&', and the sequence is the sequence 1, 2, reverse sequence. For example, 'a + b & b + a' is the sequence of characters belonging to the model, while'1 + 3 & 3-1 'is not. Requirements: To be able to run the source code in tc.
Experts answer: I have written one, you look at the use of stacks and queues *********************************** palindrome determine the input character to @ end************************************# Include stdio.h ** ** typedefstructStack (define a stack intsize; char * Base; chas * Top;) Stack; ** ** voidCreateStack (Stack * S, intsize) (S-size = size; S Base = (char *) malloc (size); STop = S-Base;) ** Push an element ** voidPush (Stack * S, charc) (** stack full, can not insert a ** if (S-Top-S-Base == S-size) (printf ("Stackisfullandcan'tpush! "); return;) else {*(++ S-Top) = c;)) voidPop (Stack * S) (** stack empty ** if (S-Top == S-Base) (printf( Stackisempty! );return;}else{S- Top**;}}voidmain(){StackS;intBegin;charc;CreateStack(&S,100);Begin=0;while(1){scanf( %c ,&c);if(c== @ )break;if(c== & &&!Begin){Begin=1;continue;}if(Begin){if(*(S.Top)==c){Pop(&S);}}elsePush(&S,c);}if(S.Top==S.Base){printf( ok*n );}else{printf( fail*n );}getch();}
  • This information provided by the users.Thanks!