#include <iostream>
#include <future>
#include <thread>
using namespace std;

int main() {
    promise<int> score_promise;
    future<int> score_future = score_promise.get_future();

    jthread t {
        [&score_promise]() {
            string line;
            int attempts = 0;
            do {
                cout << "Guess my word: ";
                getline(cin, line);
                ++attempts;
            } while (line != "banana");
            score_promise.set_value(attempts);
        }
    };

    int final_score = score_future.get();
    cout << "It took you " << final_score << " attempts!\n";
}