|
|
@@ -0,0 +1,69 @@
|
|
|
+#include <algorithm>
|
|
|
+#include <array>
|
|
|
+#include <iostream>
|
|
|
+#include <map>
|
|
|
+#include <utility>
|
|
|
+#include <vector>
|
|
|
+#include <iomanip>
|
|
|
+#include <sstream>
|
|
|
+#include <climits>
|
|
|
+#include <queue>
|
|
|
+#include <list>
|
|
|
+#include <set>
|
|
|
+#include <string>
|
|
|
+
|
|
|
+using namespace std;
|
|
|
+
|
|
|
+typedef unsigned int nat;
|
|
|
+
|
|
|
+int main()
|
|
|
+{
|
|
|
+ int game_num = 1;
|
|
|
+
|
|
|
+ while(true)
|
|
|
+ {
|
|
|
+ cin >> game_num;
|
|
|
+ if(game_num == -1)
|
|
|
+ break;
|
|
|
+
|
|
|
+ string answer, guess;
|
|
|
+ bool win = false, lose = false;
|
|
|
+ set<char> correct, correctly_guessed;
|
|
|
+
|
|
|
+ nat guesses = 7;
|
|
|
+
|
|
|
+ cin >> answer >> guess;
|
|
|
+
|
|
|
+ for(auto c : answer)
|
|
|
+ {
|
|
|
+ correct.emplace(c);
|
|
|
+ }
|
|
|
+
|
|
|
+ for(auto c : guess)
|
|
|
+ {
|
|
|
+ if(answer.find(c) != string::npos)
|
|
|
+ {
|
|
|
+ if(correctly_guessed.emplace(c).second && correctly_guessed.size() == correct.size())
|
|
|
+ {
|
|
|
+ win = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(!(--guesses))
|
|
|
+ {
|
|
|
+ lose = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ cout << "Round " << game_num << endl;
|
|
|
+ if(win)
|
|
|
+ cout << "You win." << endl;
|
|
|
+ else if(lose)
|
|
|
+ cout << "You lose." << endl;
|
|
|
+ else
|
|
|
+ cout << "You chickened out." << endl;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|