题解 | #字符串排序#

字符串排序

https://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723

直接sort排序

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int num;
    cin >> num;
    string s;
    vector<string> v;
    while(cin >> s){
        v.push_back(s);
    }
    sort(v.begin(), v.end());
    for(string s2 : v){
        cout << s2 << endl;
    }

}
全部评论

相关推荐

09-13 17:25
亲切的00后在笔试:我也遇到了,所以我早他一步查看图片
点赞 评论 收藏
分享
迷茫的大四🐶:💐孝子启动失败,改为启动咏鹅
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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