#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<string> v;
vector<string> ::iterator it;
int n;
string a;
while(cin>>n)
{
v.clear();
for(int i=0; i<n; i++)
{
cin>>a;
v.push_back(a);
}
sort(v.begin(),v.end());
for(it=v.begin(); it!=v.end(); it++)
cout<<*it<<endl;
}
/*
int n;
string a;
map<string,int>m;
map<string,int>::iterator it;
while(cin>>n)
{
m.clear();
for(int i=0; i<n; i++)
{
cin>>a;
if(m.find(a)!=m.end())
{
m[a]++;
}
else
{
m.insert(make_pair(a,1));
}
}
for(it=m.begin(); it!=m.end(); it++)
for(int i=0; i<it->second; i++)
cout<<it->first<<endl;
}
*/
return 0;
}
字符串排序(字典序)
最新推荐文章于 2024-03-05 17:49:24 发布