View Code of Problem 97

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	int a;
	while(cin >>a&&a){
		string b[a];
		for(int i=0;i<a;i++){
			cin >>b[i];
		}
		sort(b,b+a);
		for(int i=0;i<a;i++){
			if(b[i].rfind(".exe")!=-1){
				string temp=b[i].substr(0,b[i].rfind(".exe"));
				for(int j=0;j<a;j++){
					if(temp==b[j]){
						cout <<b[i]<<endl;
						break;
					}
				}
			}
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 97