View Code of Problem 97

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int t;
	while(cin>>t&&t){
		getchar();
		int k=0;
		string s[1000],c[1000];
		for(int i=0;i<t;i++){
			getline(cin,s[i]);
		}
		for(int i=0;i<t;i++){
			int pos=s[i].find(".exe");
			if(pos!=-1){
				string b=s[i].substr(0,s[i].length()-4);
				for(int j=0;j<t;j++){
					if(b==s[j]){
						c[k]=b+".exe";
						k++;
						break;
					}
				}
			}
		}
		sort(c,c+k);
		for(int i=0;i<k;i++){
			if(c[i]!=c[i+1])
				cout<<c[i]<<endl;
		}
	}	
	return 0;
} 

Double click to view unformatted code.


Back to problem 97