文章
133
粉丝
17
获赞
392
访问
10.3k
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
int main() {
int n;
string str[1000];
cin >> n;
for (int i = 0;i < n;i++) {
cin >> str[i];
}
for (int i = 0;i < n;i++) {
for (int j = 0;j < n - 1;j++) {
if (str[j].length() > str[j + 1].length()) {
swap(str[j], str[j + 1]);
}
}
}
for (int i = 0;i < n;i++) {
cout << str[i] << endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发