UVa 789 - Indexing
来源:互联网 发布:top域名表示什么意思 编辑:程序博客网 时间:2024/04/29 10:49
UVA - 789
思路:读取每行并处理每个单词(map自动按key排序)
#include <cstdio>#include <cstring>#include <string>#include <iostream>#include <sstream>#include <algorithm>#include <map>#include <set>using namespace std;int main(void) {char key;int cln = 0;string line, str;map<string, set<int>> r;cin >> key;while (getline(cin, line)) {istringstream is(line);while (is >> str) {if (str[str.size() - 1] < 'A' || str[str.size() - 1] > 'Z') str = str.substr(0, str.size() - 1);if (str[0] == key) {r[str].insert(cln);}}cln++;}for (map<string, set<int>>::iterator i = r.begin(); i != r.end(); i++) {cout << i->first;for (set<int>::iterator j = i->second.begin(); j != i->second.end(); j++)cout << " " << *j;cout << endl;}//system("pause");return 0;}
0 0
- UVa 789 - Indexing
- UVa 739 - Soundex Indexing
- Indexing
- indexing
- Indexing Strategy
- XML Indexing
- Xml Indexing
- Hierachical Indexing
- XML Indexing
- App Indexing
- Matrix Indexing
- Array Indexing
- Indexing Service查询
- Latent Semantic Indexing Model
- Indexing with Glimpse
- Indexing Arrays with Strings
- Indexing Service 索引服务
- Indexing service--OpenQuery
- Python--基础学习--基本数据类型
- ARM 学习笔记之 创建工程(keil)
- js中的prototype_记录
- Troubleshooting ORA-3137 [12333] Errors Encountered When Using Oracle JDBC Driver (文档 ID 1361107.1)
- 这周装了5天的zipline
- UVa 789 - Indexing
- .Net通用按钮事件特征码教程
- 有道云笔记下MarkDown使用
- Understanding and Diagnosing ORA-00600 [12333] / ORA-3137 [12333] Errors (文档 ID 389713.1)
- 志愿者招募
- laravel视图blade模板使用集合
- ssh登录docker容器
- #object C runtime 简介
- bzoj4059【Cerc2012】Non-boring sequences