(STL,set)安迪的第一个字典
生活随笔
收集整理的這篇文章主要介紹了
(STL,set)安迪的第一个字典
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
問(wèn)題:
輸入一個(gè)文本,找出所有不同的單詞(連續(xù)的字母序列),按字典序從小到大輸出。單詞不區(qū)分大小寫。
樣例輸入
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
分析與解答
1.set用法
集合元素不重復(fù),已從小到大排好序
具體參見(jiàn)https://blog.csdn.net/qq_40828914/article/details/80657356
2.字符串處理新方法
isalpha判斷是否為字母
tolower(),大寫變小寫
stringstream ss(s);
ss>>buf 輸入字符串,忽略空格
總結(jié)
以上是生活随笔為你收集整理的(STL,set)安迪的第一个字典的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 位运算基础知识
- 下一篇: 变速后没有声音_问答 | 现代朗动at,