题解 | #字符串排序#

字符串排序

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;
    }

}
全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务