题解 | #字符串排序#
字符串排序
https://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723
#include <iostream>
#include <set>
using namespace std;
int main() {
int n;
//multiset自带排序功能,且值可重复
multiset<string>mySet;
cin>>n;
string str;
while(n>0 && cin>>str){
mySet.insert(str);
--n;
}
for(auto itr=mySet.begin();itr!=mySet.end();++itr){
cout<<*itr<<endl;
}
}
// 64 位输出请用 printf("%lld")
查看20道真题和解析