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 ...
随机推荐
- ubuntu 18 下配置 WebStorm 编译 sass
ubuntu 18 下配置 WebStorm 编译 scss 标签(空格分隔): IDE 安装Ruby: sudo apt-get install ruby ruby -v ruby 2.5.1p57 ...
- Angular 5.x 学习笔记(2) - 生命周期钩子 - 暂时搁浅
Angular 5.x Lifecycle Hooks Learn Note Angular 5.x 生命周期钩子学习笔记 标签(空格分隔): Angular Note on cnblogs.com ...
- USB3.0驱动与2.0有什么区别
安装好usb3.0驱动就可以驱动usb 3.0设备,能够适应于大部份主板,帮助用户解决usb3.0和电脑无法正常通讯的问题,并支持winxp,win7和win8系统,是目前网络上最好用的usb3.0万 ...
- Linux xclock打不开时钟终端
一般执行该操作的都是在安装oracle数据库或其他应用时,需要测试是否可以正常弹层执行的: 网络关于这个的描述和处理大片片的,但是符合自己实际情况的,还是需要直接去确认: 两步处理: 第一步: 使用r ...
- hihocoder 后缀自动机四·重复旋律6
题目 对于\(k\in[1,n]\)求出长度为\(k\)的子串出现次数最多的出现了多少次 我直到现在才理解后缀自动机上的子树和是什么意思 非常显然的一点是 \[endpos(link(u))⊇endp ...
- hibermate一对一关联
在hibernate.cfg.xml配置<mapping class="oneToOne.IDCard" />,以及实体类的get和set方法省略了. User类 @E ...
- Makefile的变量赋值和函数
在Makefile中的定义的变量,就像是C/C++语言中的宏一样,他代表了一个文本字串,在Makefile中执行的时候其会自动原模原样地 展开在所使用的地方.其与C/C++所不同的是,你可以在Make ...
- servlet 与 tomcat版本不匹配的问题
严重: Failed to process JAR found at URL [/StudentLeave] for ServletContainerInitializers for context ...
- 【洛谷P1073】[NOIP2009]最优贸易
最优贸易 题目链接 看题解后感觉分层图好像非常NB巧妙 建三层n个点的图,每层图对应的边相连,权值为0 即从一个城市到另一个城市,不进行交易的收益为0 第一层的点连向第二层对应的点的边权为-w[i], ...
- Validform 基于表单验证
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...