#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { ios::sync_with_stdio(false); int n, i1, i2; string input[1000]; string vi[1000]; string tmp; while (cin >> n && n) { i1 = 0; i2 = 0; for (int i = 0; i < n; i++) { cin >> tmp; if (tmp.length() >= 5) { if (tmp.substr(tmp.length() - 4, tmp.length()) == ".exe") { vi[i2++] = tmp.substr(0, tmp.length() - 4); } else { input[i1++] = tmp; } } else input[i1++] = tmp; } for (int i = 0; i < i1; i++) { for (int j = 0; j < i2; j++) { if (input[i] == vi[j]) { cout << vi[j] << ".exe" << endl; } } } } return 0; } |
Double click to view unformatted code.