Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0); cout.tie(0);
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- int n, ch1 = 0;
- cin >> n;
- string c;
- set <string> q;
- vector <string> s(n);
- map <string, bool> check;
- for (int i = 0; i < n; i++) {
- cin >> c;
- if (c[1] != '?') {
- q.insert(c);
- ch1++;
- check[c] = 1;
- s[i] = c;
- continue;
- } else {
- int j = 0;
- for (j = 0; j < 100; j++) {
- c[1] = (j / 10) + '0';
- c[2] = (j % 10) + '0';
- if (check[c] == 0) {
- check[c] = 1;
- break;
- }
- }
- if (check[c] == 1 && j == 100) {
- cout << "NO";
- return 0;
- }
- }
- s[i] = c;
- }
- if (q.size() != ch1) {
- cout << "NO";
- return 0;
- }
- cout << "YES" << endl;
- for (int i = 0; i < n; i++) {
- cout << s[i] << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment