#50201: 不用sort(a,b,c)


h1130130@stu.wghs.tp.edu.tw (二丁33林以寬Ian)

學校 : 不指定學校
編號 : 313931
來源 : [60.248.154.139]
最後登入時間 :
2025-08-20 12:52:56

#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;
}