#include #include #include #include #define MaxSize 100#define ElemType chartypedef struct Stack{ ElemType * top; ElemType * base; int stacksize;}Stack;void InitStack(Stack * S);void Push(Stack * S,char e);char Pop(Stack * S);int main(void){ Stack * S=(Stack *)malloc(sizeof(Stack)); int i,Len,InStack,flag=0; char elem,a[2*MaxSize]; InitStack(S); printf("Input strings:"); gets(a); Len=strlen(a); InStack=Len/2; if(Len%2==0) { for(i=0;i base=(ElemType *)malloc(sizeof(ElemType)*MaxSize); if(!S->base) { exit(0); } S->top=S->base; S->stacksize=MaxSize;}void Push(Stack * S,char e) \*进栈*\{ if(S->top-S->base>=S->stacksize) { S->base=(ElemType *)realloc(S->base,(S->stacksize+MaxSize)*sizeof(ElemType)); if(!S->base) { exit(0); } S->top=S->base+S->stacksize; S->stacksize=S->stacksize+MaxSize; } *(S->top)=e; S->top++;}char Pop(Stack * S)\*出栈*\{ char e; if(S->top==S->base) exit(0); e=*--(S->top); return e;}