(备注:还没有去UVA提交过,暂时设为私密)
//解题思路:猜中所有字母,win,猜错超过包括7次,lose,没有猜对所有字母,且还有机会但没有继续猜,视为chickened out
#include<iostream>
#include<string>
#include<cstring>
#include<bits\stdc++.h>
using namespace std;
const int maxn=100;
int chance;
int win;
int lose;
int rnd;
int num;//需要猜测的剩余位置数
string s1;
string s2;
void guess(char ch,int len1)
{
int temp=0;
for(int i=0;i<len1;i++){
if(ch==s1[i]){
s1[i]=' ';
temp=1;
num--;
}
}
if(!temp){
--chance;
}
if(!num){//猜中所有字母
win=1;
}
if(!chance){//机会已用完
lose=1;
}
}
int main()
{
while(cin>>rnd>>s1>>s2){
if(rnd==-1){
break;
}
int len1=s1.length();
int len2=s2.length();
win=0;
lose=0;
num=len1;
chance=7;
for(int i=0;i<len2;i++){
guess(s2[i],len1);
if(win||lose){
break;
}
}
cout<<"Round"<<' '<<rnd<<endl;
if(win){
cout<<"you win"<<endl;
}else if(lose){
cout<<"you lose"<<endl;
}else{
cout<<"you chickened out"<<endl;
}
cout<<endl;
}
return 0;
}