#include #include #include using namespace std; int main() { const int digits = 10; int n[10]; int ans[digits] = {}; int matched[digits] = {}; int maxmatch; string rep; for (int i = 0; i < 10; i++) { for (int digit = 0; digit < digits; digit++) { cout << i; } cout << endl; cin >> n[i] >> rep; if(rep == "unlocked") { return 0; } } for (int i = 1; i < 10; i++) { if (n[i] == 0) { continue; } maxmatch = 0; for (int j = 0; j < digits; j++) { if (ans[j] != 0) { continue; } for (int digit = 0; digit < digits; digit++) { if (digit == j) { cout << i; } else { cout << ans[digit]; } } cout << endl; cin >> matched[j] >> rep; if(rep == "unlocked") { return 0; } maxmatch = max (matched[j], maxmatch); } for (int j = 0; j < digits; j++) { if (matched[j] == maxmatch) { ans[j] = i; } matched[j] = 0; } } for (int digit = 0; digit < digits; digit++) { cout << ans[digit]; } cout << endl; return 0; }