#include<string> #include<iostream> #include<algorithm> using namespace std; int main() { int n; string a[1000]; while (scanf("%d", &n) != EOF && n != 0) { getchar(); for (int i = 0; i < n; i++) { getline(cin, a[i]); } sort(a,a+n); for (int i = 0; i < n; i++) { if (a[i].find(".exe") != -1) { int k = a[i].find(".exe"); string b = "\0"; b.insert(0, a[i],0,k); for (int j = 0; j < n; j++) { if (a[j] == b) { cout << a[i] << endl; } } } } } return 0; } |
Double click to view unformatted code.