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 个节点的子 ...
随机推荐
- 命令行添加用户的“作为服务登录”权利(添加Windows用户的时候,门道不是一般的多)good
1.打开控制台(“开始”|“运行”中输入:MMC) 2.“文件”菜单|“添加删除管理单元”|“添加...”|选“安全模板”|“关闭”. 3.在“C:\Windows\Security\template ...
- Android:布局实例之常见用户设置界面
实现效果: 整理思路: 1.控件:文字TextView 和 右箭头ImageView 2.因为考虑到点击效果,设计为:最外层为全圆角,内层有四种情况,分别为上圆角.无圆角.下圆角和全圆角. 3.内层样 ...
- Linux命令面试常考的简单汇总
1.显示日期与时间的命令:date 2.显示日历的命令:cal 3.简单好用的计算器:bc 4.热键“命令补全或文件补齐”:Tab 5.热键“中断目前程序”:Ctrl+C 6.热键“键盘输入结束(En ...
- 超实用的PHP代码片段
一.查看邮件是否已被阅读 当你在发送邮件时,你或许很想知道该邮件是否被对方已阅读.这里有段非常有趣的代码片段能够显示对方IP地址记录阅读的实际日期和时间. 1 2 3 4 5 6 7 8 9 10 1 ...
- poj2482Stars in Your Window(线段树+离散化+扫描线)
http://poj.org/problem?id=2482 类似于上一篇 这题转化的比较巧妙 将一个点转化为一个矩形(x,y, x+w,y+h),扫描线入值为正 出值为负 也就是一根线过去 每进入一 ...
- php 类 成员变量 $this->name='abc'
<?php class test { public function getName() { $this->name='abc'; echo $this->name; } }$a=n ...
- poj2752 水题
又2b了一次…… var s:ansistring; ans,pre:..] of longint; i,k,tot:longint; procedure main; begin pre[]:=;k: ...
- (转载)关于gcd的8题
发现其实有关gcd的题目还是挺多的,这里根据做题顺序写出8题. [bzoj2818: Gcd] gcd(x,y)=质数, 1<=x,y<=n的对数 做这题的时候,懂得了一个非常重要的转化: ...
- POJ 1637 Sightseeing tour ★混合图欧拉回路
[题目大意]混合图欧拉回路(1 <= N <= 200, 1 <= M <= 1000) [建模方法] 把该图的无向边随便定向,计算每个点的入度和出度.如果有某个点出入度之差为 ...
- Spring中的事务管理
事务简介: 事务管理是企业级应用程序开发中必不可少的技术,用来确保数据的完整性和一致性 事务就是一系列的动作,它们被当作一个单独的工作单元.这些动作要么全部完成,要么全部不起作用 事务的四个关键属性( ...