uva489刽子手游戏为什么Runtime error
#include<iostream>#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char ans[10001],org[10001];
int p[10001],q[10001];
int main()
{
int i,j,m,n,k,l,s;
l=0;
s=0;
while(scanf("%d%s%s",&m,org,ans)==3&&m!=-1)
{
p[++l]=m;
n=strlen(ans);
k=strlen(org);
for(i=0;i<k;i++)
{
q[i]=org[i]-96;
}
sort(q,q+k);
for(i=0;i<=n;i++)
for(j=0;j<=k;j++)
{
p[i]=ans[i]-96;
if(p[i]==q[j]&&q[j]!=q[j+1])
s++;
}
if(s==n)
{
printf("Round %d\nYou win.\n",m);
}
if(s>=0&&s<n&&n>7)
{
printf("Round %d\nYou lose.\n",m);
}
if(s<n&&s>0&&n<=7)
{
printf("Round %d\nYou chickened out.\n",m);
}
s=0;
}
return 0;
}