Andy's First Dictionary(uva 10815) set用法
参考:https://www.cnblogs.com/yjlblog/p/6947747.html
https://blog.csdn.net/hnust_taoshiqian/article/details/43448793
https://blog.csdn.net/liuke19950717/article/details/49450817
https://blog.csdn.net/fanyun_01/article/details/66967710
#include <iostream>
#include <cstdio>
#include <set>
#include <sstream>
using namespace std;
set<string> ans;
int main()
{
string s,temp;
// freopen("总结.txt","r",stdin);
while (cin>>s)//cin遇空格结束 ~
{
int i;
for (i=;i<s.length();i++)
{
if (isalpha(s[i]))
{
s[i]=tolower(s[i]);
}
else
{
s[i]=' ';
}
}
stringstream ss(s);//ss流初始化
while (ss>>temp)//同一个cin进来的s可能有多个单词~
{
ans.insert(temp);
}
}
set<string>::iterator it;
for (it=ans.begin();it!=ans.end();it++)
{
cout<<*it<<endl;
} return ;
}
Andy's First Dictionary(uva 10815) 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 ...
- 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
Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for h ...
- UVa 10815 Andy's First Dictionary
感觉这道题要比之前几个字符串处理的题目难度要大了一些. 题目大意:给若干行字符串,提取出所有单词并去掉重复的,最后按字典顺序输出. 对于输入大致有两种思路,一种是逐个读入字符,遇到字母的话就放到wor ...
- 【UVA - 10815】Andy's First Dictionary (set)
Andy's First Dictionary Description 不提英文了 直接上中文大意吧 XY学长刚刚立下了再不过CET就直播xx的flag,为了不真的开启直播模式,XY学长决定好好学习英 ...
- UVa10815.Andy's First Dictionary
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- UVA-10815 Andy's First Dictionary (非原创)
10815 - Andy's First Dictionary Time limit: 3.000 seconds Problem B: Andy's First DictionaryTime lim ...
- 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(字符处理)
Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him ...
随机推荐
- python编写的简单的mysql巡检脚本
准备工作:1 安装python 3.5,本次使用源码安装.2 安装psutil模块,使用python3.5自带的easy_install包直接运行cd /opt/python3/bin./ ...
- github的初步认识
第一部分:我用代码写了一个简单的可以运行的helloworld代码. 其链接为:https://github.com/ljw305503/CK01.git 第二部分:GitHub是一个分布式的版本控制 ...
- bzoj5000 OI树
Description 几天之后小跳蚤即将结束自己在lydsy星球上的旅行.这时,lydsy人却发现他们的超空间传送装置的能量早在小跳蚤通过石板来到lydsy星球时就已经消耗光了.这时,小跳蚤了解到自 ...
- RHEL6.5和RHEL7 的区别(转)
Rhel6.5实验环境搭建 1)操作系统安装 RHEL7是一站式安装 2)网卡配置文件 RHEL6: /etc/sysconfig/network-scripts/ifcfg-eth0 RHEL7 ...
- HDU 3613 扩展KMP
暴力枚举大水题,判断回文,扩展KMP #include <cstdio> #include <cstring> #include <algorithm> using ...
- 2016 China Collegiate Programming Contest Final
2016 China Collegiate Programming Contest Final Table of Contents 2016 China Collegiate Programming ...
- (第五场)G max 【数论】
题目链接:https://www.nowcoder.com/acm/contest/143/G 题目描述 Give two positive integer c, n. You need to fin ...
- JAVA程序员常用软件类库下载地址整理
IT行业是个发展更新特别快的领域,每个程序员在职业生涯中都会经历各类技术和工具的更新迭代. 俗话说:工欲善其事,必先利其器.本着独乐乐不如众乐乐的精神(其实是自己健忘)本人把经常要用到的软件工具官方下 ...
- 【luogu P3178 [HAOI2015]树上操作】 题解
题目链接:https://www.luogu.org/problemnew/show/P3178 模板题 菜 #include <cstdio> #include <cstring& ...
- 【luogu P2385 青铜莲花池】 题解
题目链接:https://www.luogu.org/problemnew/show/P2385 莲花池什么的最漂亮啦! 最近刷了两天搜索= =我搜索一直是弱菜 直接套bfs #include < ...