#include<iostream> #include<string> #include<algorithm> using namespace std; string s[1000]; int main() { int n; while (cin >> n) { if (n == 0) { return 0; } for (int i = 0; i < n; ++i) { cin >> s[i]; } sort(s, s + n); for (int i = 1; i < n; ++i) { if (s[i].size() <= 4) { continue; } if (s[i].substr(s[i].size() - 4, 4) == ".exe") { for (int j = i - 1; j >= 0; --j) { if (s[i][0] != s[j][0]) { break; } if (s[j] + ".exe" == s[i]) { cout << s[i] << endl; } } } } } } |
Double click to view unformatted code.