题解 | #字符串排序#

字符串排序

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

全部评论

相关推荐

阿武同学:不要写至今,写具体哪年哪月毕业,专业技能往后排,项目往前排,共青团员可以不写
投了多少份简历才上岸
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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