前言
这个算法主要是介绍set,set最大的一个特点就是具有自动排序功能
问题描述
输入一个文本,找出所有不同的单词(连续的字母序列),按字典序从小到大输出。单词不区分大小写
样例输入
Adventures in Disneyland Two blondes were going to Disneyland when they came to a fork in the road. The sign read: “Disneyland Left.” So they went home.
样例输出
a
adventures
blondes
came
disneyland
fork
going
home
in
left
read
road
sign
so
the
they
to
two
went
were
when
算法思路
这道题目主要考察set的使用,我的代码和网上的有些不一样。对于输入内容是在一行进行测试。如果在多行,那么就会出现一直处于输入状态。
代码实现
#include<iostream>
#include<set>