#include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
int n;
cin >> n;
string s;
map<string, int> s_set;
int k = n;
for (; k >= 0; k--)
{
getline(cin, s);
if (s_set.find(s) == s_set.end())
s_set[s] = 0;
else
s_set[s] += 1;
}
map<string, int>::iterator it = s_set.begin();
for (it++; it != s_set.end(); it++)
if (it->second > 0)
{
for(int i = 0; i<= it->second; i++)
cout << it->first << endl;
}
else
cout << it->first << endl;
return 0;
}
给定n个字符串,请对n个字符串按照字典序排列。
猜你喜欢
转载自blog.csdn.net/Doutd_y/article/details/82262641
今日推荐
周排行