// UVa 10905 - Children's Game
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
struct str {
string s;
};
bool operator <(const str & a, const str & b) {
return a.s + b.s > b.s + a.s;
}
int main() {
int n;
cin >> n;
while (n) {
str st[51];
for (int i = 0; i < n; i++)
cin >> st[i].s;
sort(st, st + n);
for (int i = 0; i < n; i++)
cout << st[i].s;
cout << endl;
cin >> n;
}
return 0;
}
No comments:
Post a Comment