题解 | #字符串排序#
字符串排序
https://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723
// HJ14 字符串排序.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
vector<string>str;
while (cin >> n)
{
string s;
for (int i = 0; i < n; i++)
{
cin >> s;
str.push_back(s);
}
sort(str.begin(), str.end());
for (auto a : str)
cout << a << endl;
str.clear();
}
return 0;
}
查看12道真题和解析