UVa10615 Andy's First Dictionary(集合set)
这道题主要用到了set容器和stringstream,用起来非常方便,我第一次见识到,觉得十分的炫酷……
而且,竟然可以将自己写的单词按照字典序排列,真的太酷了。
下面是书上的代码,目前还处于初学状态,所以都是摘抄例题的代码,希望不久之后,我可以用学到的技能自己做出题来。
晚安啦。
#include<iostream>
#include<string>
#include<set>
#include<sstream>
using namespace std; set<string> dict;//string集合 int main(){
string s,buf;
while(cin>>s&&s!="quit"){
for(int i=;i<s.length();i++){
if(isalpha(s[i])) s[i]=tolower(s[i]);
else s[i]=' ';
}
stringstream ss(s);
while(ss>>buf) dict.insert(buf);
}
for(set<string>::iterator it=dict.begin();it !=dict.end();++it)
cout<<*it<<"\n";
return ;
}
UVa10615 Andy's First Dictionary(集合set)的更多相关文章
- UVa 10815 Andy's First Dictionary
感觉这道题要比之前几个字符串处理的题目难度要大了一些. 题目大意:给若干行字符串,提取出所有单词并去掉重复的,最后按字典顺序输出. 对于输入大致有两种思路,一种是逐个读入字符,遇到字母的话就放到wor ...
- UVa10815.Andy's First Dictionary
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- Problem C: Andy's First Dictionary
Problem C: Andy’s First DictionaryTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 18 Solved: 5[Submit] ...
- 【UVA - 10815】Andy's First Dictionary (set)
Andy's First Dictionary Description 不提英文了 直接上中文大意吧 XY学长刚刚立下了再不过CET就直播xx的flag,为了不真的开启直播模式,XY学长决定好好学习英 ...
- UVA-10815 Andy's First Dictionary (非原创)
10815 - Andy's First Dictionary Time limit: 3.000 seconds Problem B: Andy's First DictionaryTime lim ...
- STL语法——集合:set 安迪的第一个字典(Andy's First Dictionary,UVa 10815)
Description Andy, , has a dream - he wants to produce his very own dictionary. This is not an easy t ...
- 安迪的第一个字典(Andy's First Dictionary,UVa 10815)
Description Andy, , has a dream - he wants to produce his very own dictionary. This is not an easy t ...
- Andy's First Dictionary
Description Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy ...
- C#Dictionary集合的使用
题目:输入一串字符串字母,比如:Welcome to China,比较每个字母出现的次数,不区分大小写. 解决这道题的方法很多.可能一百个人有一百个思路.当时第一眼看到这个题我的思路是:先将接受的一串 ...
随机推荐
- 【Web网站服务器开发】apache和tomcat 阿帕奇和汤姆猫
经常在用apache和tomcat等这些服务器,可是总感觉还是不清楚他们之间有什么关系,在用tomcat的时候总出现apache,总感到迷惑,到底谁是主谁是次,因此特意在网上查询了一些这方面的资料,总 ...
- 【VS开发】socket编程原理
socket编程原理 1.问题的引入 1) 普通的I/O操作过程: UNIX系统的I/O命令集,是从Maltics和早期系统中的命令演变出来的,其模式为打开一读/写一关闭(open-write-rea ...
- TP5 isEmpty() 判空方法 所用场景
1, { }类型 { "id": 1, "name": "首页置顶", "description": "首页轮 ...
- day30 OSI七层协议
网络编程 什么是网络编程? 网络编程就是编写基于网络传输数据的应用程序 为什么需要网络编程? 在我们以前的编程中,所有的数据都是存在于本地,且只能由我们自己使用,不能进行跨电脑通讯,但是在实际的生活中 ...
- Thinkphp 使用小结
分页中带查询参数 ...->paginate(15,false,['query'=>request()->param()]); 队列后台自动开启运行 nohup php think ...
- Loj 2230. 「BJOI2014」大融合 (LCT 维护子树信息)
链接:https://loj.ac/problem/2230 思路: 设立siz数组保存虚点信息,sum表示总信息 维护子树信息link操作和access操作需要进行一些改动 可参考博客:https: ...
- 吉首大学2019年程序设计竞赛(重现赛)- A SARS病毒 (矩阵,欧拉降幂)
题目链接:https://ac.nowcoder.com/acm/contest/992/A 题意:求出长度为n的字符串个数,字符串由A.C.G.T组成,其中A和C必须成对出现. 思路:我们规定: ...
- [官网] 一个很好的 search rpm 或者是deb 包的网站
https://pkgs.org Home About About pkgs.org - Packages Search The pkgs.org is created to provide you ...
- H2内嵌数据库的使用
H2内嵌数据库的使用 H2是一个开源的嵌入式数据库引擎,采用java语言编写,不受平台的限制. 同时H2提供了一个十分方便的web控制台用于操作和管理数据库内容. H2还提供兼容模式,可以兼容一些主流 ...
- Python time strptime()方法
Python time strptime()方法 描述 Python time strptime() 函数根据指定的格式把一个时间字符串解析为时间元组. 语法 strptime()方法语法: time ...