1129.cpp

来自「学习C++ Primer中文版第四版时」· C++ 代码 · 共 44 行

CPP
44
字号
#include <iostream>
#include <algorithm>
#include <string>
#include <list>

using namespace std;

bool isShorter(const string &s1,const string &s2)
{
	return s1.size()<s2.size();
}
bool GT4(const string &s)
{
	return s.size() >=4;
}

void main()
{
	list<string> words;
	string word;
	while(cin>>word){
		words.push_back(word);
	}

	words.sort();

	list<string>::iterator it=words.begin();
	for(;it!=words.end();it++)
	{
		cout<<*it<<" ";
	}
	cout<<endl;

	words.unique();

	it=words.begin();
	for(;it!=words.end();it++)
	{
		cout<<*it<<" ";
	}
	cout<<endl;

	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?