/*********************************************************************************
Copyright(C),Your Company
Author: KimChow
Date: 2021-12-31
Description: OJ在线编程常见输入输出练习
对输入的字符串进行排序后输出
输入描述:
多个测试用例,每个测试用例一行。
每行通过空格隔开,有n个字符,n<100
输出描述:
对于每组测试用例,输出一行排序过的字符串,每个字符串通过空格隔开
输入例子1:
a c bb
f dddd
nowcoder
输出例子1:
a bb c
dddd f
nowcoder
Others: 打开以下链接可以查看正确的代码
https://ac.nowcoder.com/acm/contest/5657#question
**********************************************************************************/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
string mStr;
vector<string> mStrList;
while (cin >> mStr)
{
mStrList.push_back(mStr);
if (cin.get() == '\n')
{
sort(mStrList.begin(), mStrList.end());
for (string s : mStrList)
cout << s << " ";
cout << endl;
mStrList.clear();
}
}
return 0;
}
OJ在线编程常见输入输出练习09
于 2022-04-16 23:30:25 首次发布