1 #include <iostream>
 2 #include <string>
 3 #include <algorithm>
 4 #include <map>
 5 #include <vector>
 6 using namespace std;
 7 
 8 map<string, int> cnt;
 9 vector<string> words;
10 
11 string formatWord(const string &s);
12 
13 int main() {
14     
15     string s;
16     while(cin >> s) {
17         
18         if (s[0] == '#') break;
19         words.push_back(s);
20         
21         string fw = formatWord(s);
22         if (!cnt.count(fw)) cnt[fw] = 0;
23         cnt[fw]++;
24     }
25     
26     vector<string> ans;
27     for (int i = 0; i < words.size(); i++) {
28         
29         if ( cnt[formatWord( words[i] ) ] == 1) ans.push_back(words[i]);
30     }
31     
32     sort(ans.begin(), ans.end());
33     for (int i = 0; i < ans.size(); i++) {
34         cout << ans[i] << endl;
35     }
36     return 0;
37 }
38 
39 string formatWord(const string &s) {
40     
41     string ans = s;
42     int str_size = ans.size();
43     for (int i = 0; i <str_size; i++) {
44         
45         ans[i] = tolower(ans[i]);
46         
47     }
48     sort(ans.begin(), ans.end());
49     return ans;
50 
51 }

uva156 By sixleaves的更多相关文章

  1. 事件处理原理(IOS篇) by sixleaves

    前言 了解IOS事件处理的本质关键要先掌握几个概念.首先是事件的派发(Event Delivery)的过程, 一个是响应者链条如何构成. 事件的派发: Q1: 你有没有想过,如果你一个屏幕中有多个的V ...

  2. 再造轮子之网易彩票-第二季(IOS 篇 by sixleaves)

    02-彩票项目第二季 2.封装SWPTabBar方式一 接着我们思考如何进行封装.前面已经将过了为什么要封装, 和封装达到的效果.这里我们主要有两种封装方式,分别是站在不同的角度上看待问题.虽然角度不 ...

  3. 再造轮子之网易彩票-第一季(IOS 篇 by sixleaves)

    前言 在网上看了别人做的模仿网易彩票的项目, 于是也跟着用自己的想法做了一篇.写这篇博客的目的, 在于UI综合的一次小练习, 同时总结和串联其各个控件之间的应用.封装思想等.考虑到有人上不了githu ...

  4. Divide and Conquer.(Merge Sort) by sixleaves

    algo-C1-Introductionhtml, body {overflow-x: initial !important;}html { font-size: 14px; }body { marg ...

  5. UVa156.Ananagrams

    题目连接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  6. 操作系统基本概念(内核态与用户态、操作系统结构)-by sixleaves

    内核态与用户态(为什么存在这种机制.程序应处于哪个状态.如何判断当前所处状态.哪些功能需要内核态.如何实现这种机制) 1.首先我们应该思考清楚为什么会有内核态和用户态?(为什么存在这种机制) 因为计算 ...

  7. uva 1589 by sixleaves

    坑爹的模拟题目.自己对于这种比较复杂点得模拟题的能力概述还不够,还多加练习.贴别是做得时候一直再想如何检查车中间有没有棋子,炮中间有没有棋子.到网上参考别人的代码才发先这么简单的办法,自己尽然想不到. ...

  8. uva 101 by sixleaves

    这是一道很好的模拟题,用vector<int> p[maxn],建立模型,映射为maxn个堆.主要要掌握vector模拟堆操作的简单方法.接下来得思路是自顶向下的方式,逐步完善程序.首先根 ...

  9. uva10815 by sixleaves

    题目很简单.其实stringstream就的用法和iosteam差不多,所以学习起来是很简单的.stringstream类里面有一个string缓存,str()和str(string)成员函数.前者用 ...

随机推荐

  1. g++ error: extra qualification on member [-fpermissive]

    以下这段代码是在头文件里面的,DmaOpen DmaClose函数也是直接在class pcie_chip{}里面的.加了个额外的pcie_chip::才会报错. //delete pcie_chip ...

  2. shell脚本语法基础汇总

    shell脚本语法基础汇总 将命令的输出读入一个变量中,可以将它放入双引号中,即可保留空格和换行符(\n) out=$(cat text.txt) 输出1 2 3 out="$(cat te ...

  3. View not attached to window manager crash 的解决办法

    View not attached to window manager crash 的解决办法 转自:http://stackoverflow.com/questions/22924825/view- ...

  4. Climbing Stairs 解答

    Question You are climbing a stair case. It takes n steps to reach to the top. Each time you can eith ...

  5. 喜欢的女生快被别人抢走了,我敢怎么抢? - V2EX

    喜欢的女生快被别人抢走了,我敢怎么抢? - V2EX 三大定律镇楼: 第一定律:永远不要以为女生对你有好感.第二定律:告白等于见光死.第三定律:秀恩爱分得快.

  6. FTA

    FTA - 维基百科,自由的百科全书 FTA 维基百科,自由的百科全书   跳转至: 导航. 搜索 FTA可以指: 自由贸易协定(Free Trade Agreement) 自由贸易区(Free Tr ...

  7. Mod_Python中文文档

    Mod_Python中文文档 mod_python中文文档

  8. linux 有名管道(FIFO)

    http://blog.csdn.net/firefoxbug/article/details/8137762 linux 有名管道(FIFO) 管道的缓冲区是有限的(管道制存在于内存中,在管道创建时 ...

  9. hdu 4355 Party All the Time(三分搜索)

    Problem Description In the Dark forest, there is a Fairy kingdom where all the spirits will go toget ...

  10. MySQL Workbench导出数据库

    步骤: 1. 打开mysql workbench,进入需要导出的数据库,点击左侧栏的[Management]tab键. 2. 点选要输出的数据库 点击[Data Export] 选在要输出的数据库 选 ...