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

int main() {
    future<int> score_future = async(launch::async,
        [] {
            string line;
            int attempts = 0;
            cin.exceptions(ios::failbit | ios::badbit);
            do {
                cout << "Guess my word: ";
                getline(cin, line);
                ++attempts;
            } while (line != "banana");

            return attempts;
        }
    );

    try {
        int final_score = score_future.get();
        cout << "It took you " << final_score << " attempts!\n";
    } catch (const exception& e) {
        cout << "Exception from worker thread: " << e.what() << '\n';
    }
}
