#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int N=265;
char s[N],g[N];
int slen,glen,vislen,win,lose,chance;
void deal(char c)
{
int tem=1;
for(int i=0;i<slen;i++)
{
if(s[i]==c)
{
if(--vislen==0)
{
win=1;
return;
}
s[i]=' ';
tem=0;
}
}
if(tem)
if(--chance==0)
lose=1;
}
int main()
{
int round;
while(scanf("%d",&round)!=EOF&&round!=-1)
{
scanf("%s%s",s,g);
chance=7;
vislen=slen=strlen(s);
glen=strlen(g);
win=lose=0;
for(int i=0;i<glen;i++)
{
deal(g[i]);
if(win||lose)
break;
}
printf("Round %d\n",round);
if(win)
printf("You win.\n");
else if(lose)
printf("You lose.\n");
else
printf("You chickened out.\n");
}
return 0;
}
Hangman Judge UVA - 489
最新推荐文章于 2022-11-03 16:20:07 发布