Let the Balloon Rise


Time Limit: 2 Seconds      Memory Limit: 65536 KB

Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result.

This year, they decide to leave this lovely job to you.

Input

Input contains multiple test cases. Each test case starts with a number N (0 < N < 1000) -- the total number of balloons distributed. The next N lines contain one color each. The color of a balloon is a string of up to 15 lower-case letters.

A test case with N = 0 terminates the input and this test case is not to be processed.

Output

For each case, print the color of balloon for the most popular problem on a single line. It is guaranteed that there is a unique solution for each test case.

Sample Input

5
green
red
blue
red
red
3
pink
orange
pink
0

Sample Output

red
pink

 #include <iostream>
#include <map>
#include <string>
#include <cstdio>
using namespace std;
int main(){
int n;
string s, str;
map<string, int> mp;
while(cin >> n){
if(n == ){
break;
}
mp.clear();
for(int i = ; i < n; i++){
cin >> s;
if(mp.find(s) != mp.end())
mp[s]++;
else
mp[s] = ;
}
map<string, int>::iterator it = mp.begin();
int max = ;
while(it != mp.end()){
if(it->second > max){
max = it->second;
str = it->first;
}
it++;
}
printf("%s\n", str.c_str());
}
return ;
}

zoj 2104 Let the Balloon Rise的更多相关文章

  1. zoj 2104 Let the Balloon Rise(map映照容器的应用)

    题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2104 题目描述: Contest time again! Ho ...

  2. hdu 1004 Let the Balloon Rise

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  3. Let the Balloon Rise 分类: HDU 2015-06-19 19:11 7人阅读 评论(0) 收藏

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  4. HDU 1004 Let the Balloon Rise map

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  5. HDU1004 Let the Balloon Rise(map的简单用法)

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...

  6. HD1004Let the Balloon Rise

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...

  7. Let the Balloon Rise(map)

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  8. akoj-1073- Let the Balloon Rise

    Let the Balloon Rise Time Limit:1000MS  Memory Limit:65536K Total Submit:92 Accepted:58 Description ...

  9. HDU 1004 Let the Balloon Rise【STL<map>】

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

随机推荐

  1. React项目搭建基于Karma的CI环境

    简介 在浏览Github的时候是否经常看到这样的CI图标呢? 本文即为介绍如何为基于React的项目配置CircleCI的自动化测试环境 源码在此 本地实现 项目依赖如下: "devDepe ...

  2. git命令收集

    $ git clone ... $ git status 查看状态 $ git commit -am "XXX" 提交信息 $ git commit -am "XXXX& ...

  3. Scrapy框架的基本组成及功能使用

    1.什么是scrapy? Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架.框架的本质就是集成各种功能.具有很强通用性的项目模板. 2.安装 Linux:       pip3 in ...

  4. mac系统连接Android手机

    1. 打开终端,输入:system_profiler SPUSBDataType,查看Mac系统所有USB设备信息,找到相应的厂商Vender ID 2.输入echo "Vender ID& ...

  5. Java MVC 分页实例

    共4个文件 requestLogList.jsp RequestInfoController.java RequestInfoBean.java RequestInfoService.java 1.r ...

  6. nmon各配置项含义介绍

    1)nmon各配置项含义介绍

  7. NBUT 1119 Patchouli's Books (STL应用)

    题意: 输入一个序列,每个数字小于16,序列元素个数小于9. 要求将这个序列所有可能出现的顺序输出,而且要字典序. 思路: 先排序,输出该升序序列,再用next_permutation进行转变即可,它 ...

  8. 在Solr中配置中文分词IKAnalyzer

    李克华 云计算高级群: 292870151 交流:Hadoop.NoSQL.分布式.lucene.solr.nutch 在Solr中配置中文分词IKAnalyzer 1.在配置文件schema.xml ...

  9. python_113_socket编程

    Socket语法及相关 socket概念 socket本质上就是在2台网络互通的电脑之间,架设一个通道,两台电脑通过这个通道来实现数据的互相传递. 我们知道网络 通信 都 是基于 ip+port 方能 ...

  10. 题解 P5082 【成绩】

    随机跳题跳到了这一题,一看是个红题,本蒟蒻就 艰难地思考起来 高兴地写起来 这题实在不能用数组,用了数组就RE 一开始就卡在这上面了 说实话,这道题真的 很难 不算很难,只要照着公式往上面套就行了 废 ...