RT,样例过了。
#include<iostream>
#include<map>
#include<string>
using namespace std;
int rd;
void work(){
map<char,bool> app,gue;//表示是否出现和是否猜错
string s1,s2;
int cnt=0,no_gue=0;//猜错的次数,还没猜到的字母数
cin>>s1>>s2;
for(int i=0;i<s1.size();i++){
if(!app[s1[i]]){
app[s1[i]]=1;
no_gue++;
}
}
for(int i=0;i<s2.size();i++){
if(!app[s2[i]]||gue[s2[i]]){
cnt++;
if(cnt>=7){
cout<<"You lose."<<endl;
return;
}
}else{
gue[s2[i]]=1;
no_gue--;
}
}
if(no_gue==0){
cout<<"You win.";
}else{
cout<<"You chickened out.";
}
cout<<endl;
return;
}
int main(){
cin>>rd;
while(rd!=-1){
cout<<"Round "<<rd<<endl;
work();
cin>>rd;
}
return 0;
}