题解 | #字符串排序#

字符串排序

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

// HJ14 字符串排序.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include<iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	vector<string>str;
	while (cin >> n)
	{
		string s;
		for (int i = 0; i < n; i++)
		{
			cin >> s;
			str.push_back(s);
		}
		sort(str.begin(), str.end());
		for (auto a : str)
			cout << a << endl;
		str.clear();
	}
	return 0;
}

全部评论

相关推荐

03-18 01:22
门头沟学院 Java
肖先生~:先别说工资,现在有个工作就不错了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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