- 分享
Forever succeed
- @ 2025-6-20 14:17:10
#include <bits/stdc++.h>
using namespace std;
typedef long long in;
bool cmp(string x,string y)
{
in lenx=x.size();
in leny=y.size();
if(lenx>leny)
{
return 1;
}else if(lenx<leny){
return 0;
}else{
for(in i=0;i<x.size();i++)
{
if(x[i]>y[i])
{
return 1;
}
else if(x[i]<y[i])
{
return 0;
}
}
return 0;
}
}
int main() {
vector <string> a;
string m;
in t=0;
while(true)
{
t++;
cin>>m;
if(m==".")
{
break;
}else{
a.push_back(m);
}
}
sort(a.begin(),a.end(),cmp);
for(in i=0;i<t-1;i++)
{
cout<<a[i]<<' ';
}
return 1;
}
1 条评论
-
wangboyi LV 2 @ 2026-2-13 14:13:17太棒了
- 1