View Code of Problem 97

#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    string str;
    vector <string> a;
    string b[1000];
    while(cin >> n){
            if(n==0) break;
        for(int i = 0; i < n; ++i){
            getline(cin,str);
            a.push_back(str);
        }
        int k = 0;
        for(int i = 0; i < n; ++i){

            if(a[i].find(".exe")!=-1){

            for(int j = 0; j < n; ++j){
                if(a[j] + ".exe" == a[i])
                    b[k++] = a[i];
            }
        }
        }
        sort(b,b+k);
        for(int i =0; i < k; ++i){
            cout<< b[i] <<endl;
        }
        a.clear();

    }
    return 0;
}

Double click to view unformatted code.


Back to problem 97