#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<string> neg;
vector<string> pos;
string input;
int a;
while(cin>>a){
while(a--){
cin>>input;
if(input[0]=='-') neg.push_back(input);
else pos.push_back(input);
}
sort(neg.begin(),neg.end(),greater<string>());
sort(neg.begin(),neg.end());
for (const auto& s : neg)
cout << s << endl;
for (const auto& s : pos)
cout << s << endl;
neg.clear();
pos.clear();
}
return 0;
}
你這樣 9 大於 11
建議寫個比較的函數。