题解 | #字符串排序#

字符串排序

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")

全部评论

相关推荐

09-10 15:05
已编辑
门头沟学院 游戏后端
点赞 评论 收藏
分享
码农索隆:充分发挥学生的价值。 校长银行卡扣款100w,都以为是自动付款没关
你找实习最大的坎坷是什么
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务