Description

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<cstring>
#include<cstdio>
using namespace std;
int main()
{
char a[][];
int b[],m;
int n;
while((scanf("%d",&n))&&n!=)
{
m=;
for(int i=;i<n;i++)
{
scanf("%s",a[i]);
b[i]=;
for(int j=;j<i;j++)
{
if(strcmp(a[i],a[j])==)
{
b[j]++;
if(b[m]<b[j])
{
m=j;
}
break;
}
}
}
for(int i=;i<n;i++)
{
if(b[i]==b[m])
{
printf("%s\n",a[i]);
}
}
}
}

CDZSC_2015寒假新人(1)——基础 a的更多相关文章

  1. CDZSC_2015寒假新人(1)——基础 i

    Description “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you mus ...

  2. CDZSC_2015寒假新人(1)——基础 h

    Description Ignatius was born in a leap year, so he want to know when he could hold his birthday par ...

  3. CDZSC_2015寒假新人(1)——基础 g

    Description Ignatius likes to write words in reverse way. Given a single line of text which is writt ...

  4. CDZSC_2015寒假新人(1)——基础 f

    Description An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u i ...

  5. CDZSC_2015寒假新人(1)——基础 e

    Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever ...

  6. CDZSC_2015寒假新人(1)——基础 d

    Description These days, I am thinking about a question, how can I get a problem as easy as A+B? It i ...

  7. CDZSC_2015寒假新人(1)——基础 c

    Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the wareho ...

  8. CDZSC_2015寒假新人(1)——基础 b

    Description The highest building in our city has only one elevator. A request list is made up with N ...

  9. CDZSC_2015寒假新人(2)——数学 P

    P - P Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

随机推荐

  1. 使用图片拉伸resizableImageWithCapInsets

    在仿写QQ会话的时候背景蓝色图片是拉伸而来,但是有些地方是受保护的不能拉伸 所以定义了下面的工具类中的一个方法,专门拉伸图片 UIImageResizingModeStretch:拉伸模式,通过拉伸U ...

  2. javascript父窗口与子窗口通信

    在父窗口的js代码 //回调的函数 function alt(temp){ alert(temp); }; $("#Btn").click(function (obj) { //声 ...

  3. IOS通过PushSharp开源框架发送推送

    1,首先生成推送证书: openssl x509 -in aps_developer_identity.cer -inform DER -out aps_developer_identity.pem ...

  4. 精简jQuery Tabs

    闲来无事,周末用jQuery写了一个比较精简的Tabs,个别地方可以用到. 截图及代码如下: <!DOCTYPE html> <html> <head lang=&quo ...

  5. [Netty 1] 初识Netty

    1. 简介 最早接触netty是在阅读Zookeeper源码的时候,后来看到Storm的消息传输层也由ZMQ转为Netty,所以决心好好来研究和学习一下netty这个框架. Netty项目地址:htt ...

  6. CI框架微信开发-自定义菜单

    在CI框架下面实现了自定义菜单功能.写了一个model,一个类库.顺便附带access_token的实现方式 <?php class Makemenu{ public $menustr; pub ...

  7. Bing必应(Yahoo雅虎)搜索引擎登录网站 - Blog透视镜

    Bing必应是微软的搜索引擎,原本是置放在MSN网站上的,微软重新开发并改为新的名子,只要连到官网,登录网站后,过了不久,搜索引擎就会用爬虫,来检索你的网站,等过了一阵子之后,自然就可以找到你的文章. ...

  8. WinForm 鼠标进入移开窗体事件,因子控件导致的误触发

    /// <summary> /// 重写OnControlAdded方法,为每个子控件添加MouseLeave事件 /// </summary> /// <param n ...

  9. Qt的十六进制的控件

    Qt没有这样的Widget,自己写一个吧.我曾经用MFC写过一个,代码不多,不到2000行,估计用Qt写不到1000行就够了. 可以参考这个qhexedit2 - QHexEdit is a Bina ...

  10. 正则取页面图片URL和TABLE BackGround

    /// <summary> /// 根据html文本返回url地址集合 /// </summary> /// <param name="sHtmlText&qu ...