Andy's First Dictionary---set,stringstream
https://cn.vjudge.net/contest/177260#problem/C
stringstream :https://blog.csdn.net/xw20084898/article/details/21939811
学习:http://www.cnblogs.com/yjlblog/p/6947747.html
注意set的*
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<stdlib.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<string>
#include<set>
#include<cctype>
#include<sstream>
#define mem(a) memset(a,0,sizeof(a))
#define LL long long
using namespace std;
const long long N=1e9+;
set<string>ans;
int main()
{
//用set,元素只能出现一次,并且插入可以从小到大排序
string s,tmp;
while(cin>>s)
{
for(size_t i=;i<s.size();i++) //size_t一般用来表示一种计数
if(isalpha(s[i])) //小写字母返回2,大写字母返回1
s[i]=tolower(s[i]); //变小写
else s[i]=' ';
stringstream ss(s);
while(ss>>tmp) ans.insert(tmp); //向tmp中写入值,传值<<,
}
for(set<string>::iterator it=ans.begin();it!=ans.end();it++)
{
cout<<*it<<endl;
/*set不是数组 只能通过迭代器(iterator)把里面的元素倒出来
迭代器相当于是指针 扫描的是地址 因此输出的时候需要用*variation*/
}
return ;
}
//输出时在空行输入 ctrl+z+回车
Andy's First Dictionary---set,stringstream的更多相关文章
- I - Andy's First Dictionary(set+stringstream)
Description Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy ...
- 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& ...
- 【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 ...
- Problem C: Andy's First Dictionary
Problem C: Andy’s First DictionaryTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 18 Solved: 5[Submit] ...
- C#中的Dictionary类,默认key是区分大小写的
在C#中定义一个Dictionary Dictionary<string,string> dictionary = new Dictionary<string,string>( ...
- 学习人工智能的第五个月[字典学习[Dictionary Learning,DL]]
摘要: 大白话解释字典学习,分享第五个月的学习过程,人生感悟,最后是自问自答. 目录: 1.字典学习(Dictionary Learning,DL) 2.学习过程 3.自问自答 内容: 1.字典学习( ...
- 安迪的第一个字典(Andy's First Dictionary,Uva 10815)
输入一个文本,找出所有不同的单词(连续的字母序列),按字典序从小到大输出.单 词不区分大小写. 样例输入: Adventures in Disneyland Two blondes were goin ...
随机推荐
- Magento2.X 后端开发简要1
Megento2.X 后端开发简要 根目录位置 组件的根目录是其文件夹和文件所在的组件的顶级目录.根据您安装的MaMeto开发环境,组件的根目录可以位于两个位置: 1.<Magento inst ...
- python学习day14 装饰器(二)&模块
装饰器(二)&模块 #普通装饰器基本格式 def wrapper(func): def inner(): pass return func() return inner def func(): ...
- 初识 go 语言:语法
目录 语法 for 循环 if 语句 switch 语句 defer 语句 defer 栈 结束 前言: go语言系列第二篇,主要讲述go语言的语法,如循环,if判断,swich语句,defer语句, ...
- 继续沿用旧的网络访问模式Apache HTTP 客户端,防止Android9闪退
注意位置,在application 节点里面.
- 信号(1): signal
1. 头文件#include <signal.h> 2. 功能设置某一信号的对应动作 3. 函数原型void (*signal(int signum,void(* handler)(int ...
- es6常用的
常用: let关键字: 1. 作用: * 与var类似, 用于声明一个变量2. 特点: * 在块作用域内有效 * 不能重复声明 * 不会预处理, 不存在提升3. 应用: * 循环遍历加监听 * 使用l ...
- 监控c3p0的连接池
SqlSession session = SessionFactory.getSqlSession(dbid); List<Map<String, Object>> resul ...
- 基于89C51/52单片机的红外线遥控驱动
目录 说明 IR.h IR.c 说明 编码格式:NEC IR.h /************************************************************ * @Pr ...
- WPS或xls 数据分列 清洗
一 .一般分离 时间:2017年11月27日14:55:12 数据如下: 501陈**:田莨铺58 502陈**:田莨铺58 503陈**.六麻杨冲58元 504陈**.石脚哗.200元 505陈** ...
- Spring系列(三) Bean装配的高级技术
profile 不同于maven的profile, spring的profile不需要重新打包, 同一个版本的包文件可以部署在不同环境的服务器上, 只需要激活对应的profile就可以切换到对应的环境 ...