#include <bits/stdc++.h>
#define ll long long
using namespace std;
struct done
{
string s;
int len;
}a[25];
int cmp(done a,done b)
{
return a.len<b.len;
}
int main()
{
int cnt=0;
while(1)
{
string c;
cin>>c;
if(c=="#")
break;
a[cnt].s=c;
a[cnt].len=c.length();
cnt++;
}
sort(a,a+cnt,cmp);
for(int i=0;i<cnt;i++)
{
cout<<a[i].s<<' ';
}
return 0;
}
為什么輸入
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
#
輸出是
i q p o n m l k j a h g f e d c b
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/240236.html
標籤:新手樂園
上一篇:Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+的問題
下一篇:c語言基礎如夢
