UVa123 - Searching Quickly
题目地址:点击打开链接
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的更多相关文章
- STL --- UVA 123 Searching Quickly
UVA - 123 Searching Quickly Problem's Link: http://acm.hust.edu.cn/vjudge/problem/viewProblem.acti ...
- uva 123 Searching Quickly
Searching Quickly Background Searching and sorting are part of the theory and practice of computer ...
- 刘汝佳 算法竞赛-入门经典 第二部分 算法篇 第五章 3(Sorting/Searching)
第一题:340 - Master-Mind Hints UVA:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Item ...
- Volume 1. Sorting/Searching(uva)
340 - Master-Mind Hints /*读了老半天才把题读懂,读懂了题输出格式没注意,结果re了两次. 题意:先给一串数字S,然后每次给出对应相同数目的的一串数字Si,然后优先统计Si和S ...
- UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...
- 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 ...
- 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 ...
- 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 ...
- Codeforces Round #236 (Div. 2) C. Searching for Graph(水构造)
题目大意 我们说一个无向图是 p-interesting 当且仅当这个无向图满足如下条件: 1. 该图恰有 2 * n + p 条边 2. 该图没有自环和重边 3. 该图的任意一个包含 k 个节点的子 ...
随机推荐
- 版本管理工具介绍—Git篇
前篇 如题,提起版本管理工具相信做C#开发 还是对Git比较陌生 我们可能更熟悉vss.svn 记录此文的目的 更是为以后的前段学习做基础 现在的技术比如nodeJs angularJs ==都 ...
- Servlet课程0426(八)Servlet分页技术
Welcome.java //登录界面 package com.tsinghua; import javax.servlet.http.*; import java.io.*; import java ...
- HeadFirst设计模式之适配器模式
一. 1. 2.The Adapter Pattern converts the interface of a class into another interface the clients exp ...
- Cobalt Strike
http://www.77169.com/hack/201512/222080.shtm
- atoi函数的实现(考虑不同进制、溢出)
2013-07-08 16:21:15 atio就是将ASCII码表示的字符为int型数据,看似简单的问题,实际上需要考虑的很多.对于简单的问题,考虑是否全面就显得特别重要. 小结: 对于该函数的实现 ...
- Vim 配色设置与配色脚本语法
几个给tag加颜色的插件 https://github.com/octol/vim-cpp-enhanced-highlight:基于tag的c family语法高亮 https://github.c ...
- NFC(7)向NFC硬件写入数据的两个示例(nfc硬件启动android应用,nfc硬件打开uri)
向NFC标签写入数据基本步骤 1,获取Tag对象 Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); 2,判断NFC标签的数据类型(通 ...
- Android 权限查寻表
示例 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=" ...
- XSLT 处理程序是如何工作的
与 JSP.PHP 和其他 Web 开发语言的比较 在本文中,Benoit Marchal 考察了 XSLT 处理程序的工作原理.为了说明他的观点,他编写了专门的样式表把处理中的某些方面凸显出来.他特 ...
- Android开发UI之ListView中的Button点击设置
在ListView的Item中,如果有Button控件,那么要实现Button和Item点击都有响应,可以将Item的Layout中Button的focusable属性设为false,然后设置layo ...