题解 | #字符串排序#
字符串排序
https://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723
使用 C++ 容器库 multiset, 重复有序的集合,进行存储和排序处理
#include <string> #include <iostream> #include <algorithm> #include <set> using namespace std; void paixu() { int n; cin >> n; multiset<string> oset; // 可重复的有序集合 string str; while (cin >> str) { oset.insert(str); } set<string>::iterator it = oset.begin(); while (it != oset.end()) { cout << *(it++) << endl; } } int main() { paixu(); return 0; }