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 个节点的子 ...
随机推荐
- Servlet课程0424(一) 通过实现Servlet接口来开发Servlet
//这是我的第一个Servlet,使用实现Servlet接口的方式来开发 package com.tsinghua; import javax.servlet.*; import java.io.*; ...
- ENVI5.1安装破解教程
原文地址: ENVI5.1安装破解_百度经验 http://jingyan.baidu.com/article/020278118b5ded1bcd9ce57a.html ENVI5.1_x86 ...
- Android ActionBar隐藏修改图标和标题
有时候在一些子页面或者内容页面,不需要显示ActionBar的标题栏图标.可用如下方式进行设置. 首先获取到ActionBar对象 ActionBar actionBar=getActionBar() ...
- 【POJ】3415 Common Substrings
后缀数组可解.使用单调栈优化. /* 3415 */ #include <iostream> #include <sstream> #include <string> ...
- Emulator control为灰色的情况
新建了一个虚拟机,然后发现Emulator control为灰色,让eclipse重启下就可以了,然后就可以使用了.
- hdu 4502 吉哥系列故事——临时工计划(dp)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4502 思路:一个简单的dp ,比赛时没做出来呢..... d[i]代表 到第i天时的最大值 #includ ...
- hdu 4642 Fliping game(博弈)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4642 题意:给定一个棋盘,0表示向下,1表示向上,选一个x,y, 然后翻转从x,y 到n,m.的所有硬币, ...
- c# equals与==的区别
对于值类型,如果对象的值相等,则相等运算符 (==) 返回 true,否则返回 false.对于string 以外的引用类型,如果两个对象引用同一个对象,则 == 返回 true.对于 string ...
- SQLite Helper (C#) zt
http://www.codeproject.com/Articles/746191/SQLite-Helper-Csharp This small class (SQLiteHelper.cs) i ...
- 犯罪构成三层次记忆口诀 zt
犯罪构成三层次记忆口诀 2012-02-17 来源:为你辩护网 浏览次数:232 0 众所周知,犯罪构成“四要件”和犯罪构成“三层次”(“三阶层”)都是分析具体刑事案件的辅助性工具.犯罪构成四要件是指 ...