给出一串单词,把所有单词改小写去重按字典序输出。
set可以解决去重和排序问题。
set中每个元素最多只出现一次
set中的元素已经从小到大排序好
如何通过迭代器从小到大遍历所有元素
for (set<string>::iterator i = d.begin(); i != d.end(); i++)
cout << *i << endl;
在主函数中输入字符串,把所有单词改小写去重按字典序输出。
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