华为机试-字符串排序
字符串排序
http://www.nowcoder.com/questionTerminal/5af18ba2eb45443aa91a11e848aa6723
直接使用c++11 multiset存输入字符串,自动排序
#include<iostream> #include<set> #include<string> using namespace std; int main() { multiset<string> ms; int num = 0; string str = ""; cin >> num; while (num) { --num; cin >> str; ms.insert(str); } for (multiset<string>::iterator it=ms.begin();it!=ms.end();++it) { cout << *it<<endl; } }