#include #include using namespace std; int main() { string key; for (int i = 0; i < 10; ++i) { int maxMatched = 0; int maxDigit = 0; for (int k = 0; k < 10; ++k) { string challenge = key; challenge.push_back('0' + k); if (key.size() < 9) { challenge.append(string(9 - key.size(), '0')); } cout << challenge << endl; int matched; string locked; cin >> matched >> locked; if (locked == "unlocked") { return 0; } if (matched > maxMatched) { maxDigit = k; maxMatched = matched; } } key.push_back('0' + maxDigit); } return 0; }