
程序代码:
#include <iostream>
#include <algorithm>
#include <iterator>
#include <string>
using namespace std;
int main( void )
{
size_t n;
string buf[20];
// 输入
cin >> n;
copy_n( istream_iterator<string>(cin), n, buf );
// 排序
sort( buf, buf+n, [](const string& a, const string& b){return a+b>b+a;} );
// 输出
copy( buf, buf+n, ostream_iterator<string>(cout,"") ) = "\n";
}