题目地址:点击打开链接

C++代码:

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <cctype>
#include <cstdio>
using namespace std;
int main()
{
set<string> ignore;
string str;
multimap<string,string> ssm;
while(cin>>str&&str!="::")
ignore.insert(str);
getchar();
while(getline(cin,str))
{
int i;
for(i=0;i<str.size();++i)
str[i]=tolower(str[i]);
for(i=0;i<str.size();i++)
{
if(!isalpha(str[i]))
continue;
int j=i;
while(j<str.size()&&isalpha(str[j]))
++j;
string key_str(str,i,j-i);
if(!ignore.count(key_str))
{
for(int k=0;k<key_str.size();++k)
key_str[k]=toupper(key_str[k]);
string t(str);
t.replace(i,j-i,key_str);
ssm.insert(make_pair(key_str,t));
}
i=j;
}
}
map<string,string>::const_iterator iter=ssm.begin();
while(iter!=ssm.end())
{
cout<<iter->second<<endl;
++iter;
}
return 0;
}

UVa123 - Searching Quickly的更多相关文章

  1. STL --- UVA 123 Searching Quickly

    UVA - 123 Searching Quickly Problem's Link:   http://acm.hust.edu.cn/vjudge/problem/viewProblem.acti ...

  2. uva 123 Searching Quickly

     Searching Quickly  Background Searching and sorting are part of the theory and practice of computer ...

  3. 刘汝佳 算法竞赛-入门经典 第二部分 算法篇 第五章 3(Sorting/Searching)

    第一题:340 - Master-Mind Hints UVA:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Item ...

  4. Volume 1. Sorting/Searching(uva)

    340 - Master-Mind Hints /*读了老半天才把题读懂,读懂了题输出格式没注意,结果re了两次. 题意:先给一串数字S,然后每次给出对应相同数目的的一串数字Si,然后优先统计Si和S ...

  5. UVA题目分类

    题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...

  6. Searching External Data in SharePoint 2010 Using Business Connectivity Services

    from:http://blogs.msdn.com/b/ericwhite/archive/2010/04/28/searching-external-data-in-sharepoint-2010 ...

  7. Ehcache(2.9.x) - API Developer Guide, Searching a Cache

    About Searching The Search API allows you to execute arbitrarily complex queries against caches. The ...

  8. Use Word 2010's Navigation Pane to quickly reorganize documents

    Use Word 2010's Navigation Pane to quickly reorganize documents http://www.techrepublic.com/blog/mic ...

  9. Codeforces Round #236 (Div. 2) C. Searching for Graph(水构造)

    题目大意 我们说一个无向图是 p-interesting 当且仅当这个无向图满足如下条件: 1. 该图恰有 2 * n + p 条边 2. 该图没有自环和重边 3. 该图的任意一个包含 k 个节点的子 ...

随机推荐

  1. Android:自定义适配器

    无论是ArrayAdapter还是SimpleAdapter都继承了BaseAdapter,自定义适配器同样继承BaseAdapter 实例:Gallery实现图片浏览器 <?xml versi ...

  2. Agri Net POJ1258 && Constructing Roads POJ2421

    题意,在给出的图中,使用最小花费的边,使这个图仍然连通. #include <cstdio> #include <algorithm> #include <cstring ...

  3. std::remove

    #include <algorithm> template< class ForwardIt, class T > ForwardIt remove( ForwardIt fi ...

  4. xml格式化

    Vim怎么格式化xml,完全不会,vim的缩进也搞不明白

  5. poj 2524 Ubiquitous Religions (并查集)

    题目:http://poj.org/problem?id=2524 题意:问一个大学里学生的宗教,通过问一个学生可以知道另一个学生是不是跟他信仰同样的宗教.问学校里最多可能有多少个宗教. 也就是给定一 ...

  6. POJ 2318 (叉积) TOYS

    题意: 有一个长方形,里面从左到右有n条线段,将矩形分成n+1个格子,编号从左到右为0~n. 端点分别在矩形的上下两条边上,这n条线段互不相交. 现在已知m个点,统计每个格子中点的个数. 分析: 用叉 ...

  7. Java中的volatile

    关于volatile 在JVM 1.2之前,Java的内存模型实现总是从主存读取变量,是不需要进行特别的注意的.而随着JVM的成熟和优化,现在在多线程环境下 volatile关键字的使用变得非常重要. ...

  8. Java [Leetcode 283]Move Zeroes

    题目描述: Given an array nums, write a function to move all 0's to the end of it while maintaining the r ...

  9. dubbo + zookeeper 环境搭建

    一.zookeeper windows部署 1.下载安装 到官网下载解压版后解压至F:\server\zookeeper-3.4.8,剩下为文件配置工作: 2.本地伪集群 1) 在F:\server\ ...

  10. jquery在线引用的地址

    1. 很多网站都是使用这种方式引入,客户的浏览器可能已经缓存过了 jquery.可以直接调用本地的,速度更快… 2. Google code 使用了 cdn 技术在很多地方有节点服务器,加载 jque ...