列车箱调度问题求解,刚学栈、队联,总是不知道哪里出问题,这个PTA上说段错误,有没有好兄弟解答一下啊

#include
#define max 1000
using namespace std;
typedef struct{
char *top;
char *base;
int size;
}stack;
void init (stack &s)
{
s.base=new char[max];
if(!s.base)
cout<<"閿欒";
s.top=s.base;
s.size=max;
}
void push(stack &s,char e)
{
if(s.top-s.base==s.size)
cout<<"鏍堟弧";
*s.top++=e;
}
char pop(stack &s)
{
if(s.base==s.top)
cout<<"鏍堢┖";
return(*--s.top);
}
char getpop(stack s)
{
char tmp;
tmp=*--s.top;
return tmp;
}
int fempty(stack s)
{
if(s.top!=s.base)
return 1;
else
return 0;
}
int main()
{
stack s1,s2,s3;
init(s1);
init(s2);
init(s3);
char x;
char a[26];
char b[26];
int p=1,i=0,j=0;
while((x=getchar())!='\n')
{
a[i++]=x;
}
char y;
while((y=getchar())!='\n')
{
b[j++]=y;
}
if((i!=j)||(i>=27))
return 0;
for(int i1=i-1;i1>=0;i1--)
{
push(s1,a[i1]);
}
for(int j1=j-1;j1>=0;j1--)
{
push(s2,b[j1]);
}
int aa[26],k=0;
while(fempty(s1))
{
if(getpop(s1)!=getpop(s2))
{
char tmp;
tmp=pop(s1);
push(s3,tmp);
aa[k++]=13;
}
else
{
pop(s1);
pop(s2);
aa[k++]=12;
}
}//while
while(fempty(s3)&&p)
{
if(getpop(s3)!=getpop(s2))
{
{
cout<<"Are you kidding me?" ;
p=0;
}
}
else
{
pop(s3);
pop(s2);
aa[k++]=32;
}
}//while
if(p)
{
for(int k1=0;k1<k-1;k1++)
{
if(aa[k1]==13)
cout<<"1->3"<<endl;
if(aa[k1]==12)
cout<<"1->2"<<endl;
if(aa[k1]==32)
cout<<"3->2"<<endl;
}
if(aa[k-1]==13)
cout<<"1->3";
if(aa[k-1]==12)
cout<<"1->2";
if(aa[k-1]==32)
cout<<"3->2";
}
return 0;
}

*s.top++=e;
改成
*s.top = e;
s.top++;