uva 123 stl大法好
来源:互联网 发布:fm2016苏亚雷斯数据 编辑:程序博客网 时间:2024/05/29 18:45
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <ctype.h>
using namespace std;
set<string> list;
multimap<string, string> ans;
int main()
{
string s;
string line;
list.clear();
ans.clear();
while(getline(cin,s))
{
if(s == "::")
break;
for( int i = 0; s[i] != '\0'; i++)
s[i] = tolower(s[i]);
list.insert(s);
}
while(getline(cin,line))
{
for( int i = 0; i<line.size(); i++)
line[i] = tolower(line[i]);
for( int i = 0; i < line.size(); i++)
{
if(!isalpha(line[i]))
continue;
string str;
int j = i;
while(isalpha(line[j]))
{
str += line[j];
j++;
}
if(!list.count(str))
{
for( int k =0; str[k] != '\0'; k++)
str[k] = toupper(str[k]);
string str3 = line;
str3.replace(i, str.size(), str);
ans.insert(make_pair(str, str3));
}
i = j;
}
}
map<string,string> :: iterator it = ans.begin();
for( ; it != ans.end(); it++)
cout<<it->second<<endl;
return 0;
}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <ctype.h>
using namespace std;
set<string> list;
multimap<string, string> ans;
int main()
{
string s;
string line;
list.clear();
ans.clear();
while(getline(cin,s))
{
if(s == "::")
break;
for( int i = 0; s[i] != '\0'; i++)
s[i] = tolower(s[i]);
list.insert(s);
}
while(getline(cin,line))
{
for( int i = 0; i<line.size(); i++)
line[i] = tolower(line[i]);
for( int i = 0; i < line.size(); i++)
{
if(!isalpha(line[i]))
continue;
string str;
int j = i;
while(isalpha(line[j]))
{
str += line[j];
j++;
}
if(!list.count(str))
{
for( int k =0; str[k] != '\0'; k++)
str[k] = toupper(str[k]);
string str3 = line;
str3.replace(i, str.size(), str);
ans.insert(make_pair(str, str3));
}
i = j;
}
}
map<string,string> :: iterator it = ans.begin();
for( ; it != ans.end(); it++)
cout<<it->second<<endl;
return 0;
}
0 0
- uva 123 stl大法好
- [数论?(STL大法好)&NOIP2004]火星人
- Foj 2203 Problem 2203 单纵大法好 stl应用
- hdu 5676 ztr loves lucky numbers(STL大法好)
- hdu 5676 ztr loves lucky numbers(STL大法好)
- uva 138 Street Numbers(打表大法好)
- clang 大法好
- DFS大法好
- UVA10499scanf大法好
- python大法好!
- rope大法好
- 盲打大法好
- 分块大法好
- Lombok大法好
- Python大法好
- container_of大法好
- 集成学习大法好
- 交换大法好
- NDK开发历程(一):android native code的调试方法
- Yale开放课程博弈论6
- Linux用户空间与内核空间
- JAVA线程池例子
- 怎样在github上协同开发
- uva 123 stl大法好
- Linux 學習 --- 磁盤分區/關係+掛載+表示方法
- 函数指针和函数对象
- 字典树(讲解+模版)
- CListCtrl用法
- CL : warning : Inclusion of header files from include/Qt is deprecated.
- VS2010下SQLite3生成lib库文件
- 开通博客了
- Mac OSX10.9 上 Cocos2dx 3.1.1 开发的环境搭建