题解 | #字符串排序#

字符串排序

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

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int n = 0;
    cin>>n;
    vector<string> vec;
    while(n--){
        string str;
        cin>>str;
        vec.push_back(str);
    }
   
    sort(vec.begin(), vec.end());
    for(int i = 0; i < vec.size(); i++){
        cout<<vec[i]<<endl;
    }
    
    return 0;
}
华为题库题解 文章被收录于专栏

牛客华为题库的题解

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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