题解 | #字符串排序#
字符串排序
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;
}
华为题库题解 文章被收录于专栏
牛客华为题库的题解