UVA 10815:Andy's First Dictionary(STL)
题意:给出一段英文,里面包含一些单词,空格和标点,单词不区分大小写,默认都为小写。按照字典序输出这些单词(这些单词不能有重复,字母全部变成小写)
stringstream:包含在头文件#include<sstream>中,能将一个字符串分割,用>>输出某些元素
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <limits.h>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <string>
#include <sstream>
#define ll long long
#define ms(a) memset(a,0,sizeof(a))
#define pi acos(-1.0)
#define INF 0x3f3f3f3f
const double E=exp(1);
const int maxn=1e6+10;
using namespace std;
int main(int argc, char const *argv[])
{
ios::sync_with_stdio(false);
set<string>se;
string ci;
string danci;
while(cin>>ci)
{
for(int i=0;i!=ci.length();i++)
{
if(isalpha(ci[i]))
ci[i]=tolower(ci[i]);
else
ci[i]=' ';
}
stringstream ch(ci);
while(ch>>danci)
se.insert(danci);
}
set<string>::iterator it;
for(it=se.begin();it!=se.end();it++)
cout<<*it<<endl;
return 0;
}
UVA 10815:Andy's First Dictionary(STL)的更多相关文章
- 【UVA - 10815】Andy's First Dictionary (set)
Andy's First Dictionary Description 不提英文了 直接上中文大意吧 XY学长刚刚立下了再不过CET就直播xx的flag,为了不真的开启直播模式,XY学长决定好好学习英 ...
- Uva 10815 Andy's First Dictionary(字符串)
题目链接:https://vjudge.net/problem/UVA-10815 题意 找出一段文本中的所有单词,以小写形式按照字典序输出. 思路 用空白符替换文本中所有非字母字符后再次读入. 代码 ...
- 【例题5-3 UVA - 10815】Andy's First Dictionary
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 用stringstream来处理中间的标点. ->直接把他变成一个空格. 然后重新输入进去. set默认的字典序就是升序的了. ...
- 【UVA】12504 Updating a Dictionary(STL)
题目 题目 分析 第一次用stringstream,真TMD的好用 代码 #include <bits/stdc++.h> using namespace std; int ...
- 51nod-1065:最小正子段和(STL)
N个整数组成的序列a11,a22,a33,…,ann,从中选出一个子序列(aii,ai+1i+1,…ajj),使这个子序列的和>0,并且这个和是所有和>0的子序列中最小的. 例如:4,-1 ...
- UVA LA 7146 2014上海亚洲赛(贪心)
option=com_onlinejudge&Itemid=8&page=show_problem&category=648&problem=5158&mosm ...
- 架构设计:负载均衡层设计方案(3)——Nginx进阶
版权声明:欢迎转载,但是看在我辛勤劳动的份上,请注明来源:http://blog.csdn.net/yinwenjie(未经允许严禁用于商业用途!) 目录(?)[-] Nginx继续进阶 1gzip ...
- 架构设计:负载均衡层设计方案(2)——Nginx安装
来源:http://blog.csdn.net/yinwenjie(未经允许严禁用于商业用途!) 目录(?)[-] Nginx重要算法介绍 1一致性Hash算法 2轮询与加权轮询 Nginx的安装 1 ...
- Vue 源码解析:深入响应式原理(上)
原文链接:http://www.imooc.com/article/14466 Vue.js 最显著的功能就是响应式系统,它是一个典型的 MVVM 框架,模型(Model)只是普通的 JavaScri ...
随机推荐
- JAVA反射会降低你的程序性能吗?
原文出处 早两天写了<从把三千行代码重构成15行代码谈起>这篇文章,看到评论中有一些同学的回复还是在质疑反射的性能,好像程序用上了反射,就像开上了拖拉机似的.本来我觉得这个话题没有什么好讨 ...
- ContentPresenter
这是2年前写了一篇文章 http://www.cnblogs.com/Clingingboy/archive/2008/07/03/wpfcustomcontrolpart-1.html 我们先来看M ...
- English trip -- VC(情景课)4 C My feet hurt 我脚痛
xu言: You're the best... Grammar focus 语法点: eye eyes hand hands foot feet tooth teeth arm arms leg ...
- 20170617xlVBA销售数据分类汇总
Public Sub SubtotalData() AppSettings 'On Error GoTo ErrHandler Dim StartTime, UsedTime As Variant S ...
- codeforces 484b//Maximum Value// Codeforces Round #276(Div. 1)
题意:给一个数组,求其中任取2个元素,大的模小的结果最大值. 一个数x,它的倍数-1(即kx-1),模x的值是最大的,然后kx-2,kx-3模x递减.那么lower_bound(kx)的前一个就是最优 ...
- CentOS7 install apache
1. yum install httpd 2. config /etc/httpd/conf/httpd.conf <VirtualHost *:80> ServerName www.l ...
- HTML5绘制几何图形
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head> < ...
- spark出现task不能序列化错误的解决方法 org.apache.spark.SparkException: Task not serializable
import org.elasticsearch.cluster.routing.Murmur3HashFunction; import org.elasticsearch.common.math.M ...
- HashMap相关(二)
基于哈希表的 Map 接口的实现.此实现提供所有可选的映射操作,并允许使用 null 值和 null 键.(除了不同步和允许使用 null 之外, HashMap 类与 Hashtable 大致相同. ...
- 对va_list; va_start ; va_end ;vsprintf理解(转)
以下为转载内容: int printf(const char* fmt, ...) { va_list args; int i; //1.将变参转化为字符串 va_start(args,fmt); v ...