//WORDLE GAME
#include <bits/stdc++.h>
using namespace std;
//将words(见my blog)中的内容复制到这里
//将answers(见my blog)中的内容复制到这里
int tot=1158;
int sum=12972;
string answer;
string inputst;
bool isin(string s){
for(int i=1;i<=sum;i++)if(s==words[i])return 1;
return 0;
}
int main(){
srand(time(NULL));
int ans=rand()%tot+1;
answer=answers[ans];
for(int i=1;i<=6;i++){
cout<<"-------attempt "<<i<<"-------"<<'\n';
L:;
cin>>inputst;
if(!isin(inputst)){
cout<<"pls input again\n";
goto L;
}
if(inputst==answer){
cout<<"You win!\n";
return 0;
}
int vis[5]={-1,-1,-1,-1,-1};//2=green,1=yellow,0=gray
int color[5]={0,0,0,0,0};//2=green,1=yellow,0=gray
for(int j=0;j<=4;j++){
if(inputst[j]==answer[j])color[j]=2,vis[j]=1;
}
for(int j=0;j<=4;j++){
if(vis[j]==1)continue;
for(int k=0;k<=4;k++){
if(inputst[j]==answer[k]&&vis[k]==-1)color[j]=1,vis[j]=1;
}
}
for(int i=0;i<=4;i++)cout<<color[i];
cout<<'\n';
}
cout<<"You lost!\nThe answer is ";
cout<<answer;
}