View Code of Problem 97

#include<iostream>
#include<string>
#include<cstring>
#include<math.h>
#include<algorithm>
using namespace std;

int main(){
	int n;
	while(cin>>n){
		if(n==0)break;
		int l=0,k=0;
		string s[1001],a[1001];
		string temp;
		for(int i=0;i<n;i++){
			cin>>s[i];
			l=s[i].length();
			temp=s[i];
			if(temp[l-1]=='e'&&temp[l-2]=='x'&&temp[l-3]=='e'){
				a[k++]=s[i].substr(0,l-4);
			}
		}
		sort(a,a+k);
		for(int i=0;i<k;i++){
			for(int j=0;j<n;j++)
			if(a[i]==s[j]){
				cout<<a[i]<<".exe"<<endl;
			}
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 97