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. MRC BlOCK ARC

       /*-------------------MRC环境中-------------------------*/     //使用局部变量:a到block块中,为了在block中能够使用这个变量,将 ...

  2. 关于uisliderview 监听停止滑动的状态

    今天遇到一个问题,做颜色控制的时候,通过slider 改变颜色的亮度.如果直接在slider 上绑定事件,则改变一次就需要向服务器发送一次请求.这种是显然不合理的. 所以使用了下面的解决方法 先将sl ...

  3. 常见maven镜像

    国内连接maven官方的仓库更新依赖库,网速一般很慢,收集一些国内快速的maven仓库镜像以备用. ====================国内OSChina提供的镜像,非常不错=========== ...

  4. c++设计模式之观察者模式

    概念:定义对象间的一种一对多的依赖关系,当一个对象的状态发生改变时,所有依赖于它的对象都得到通知并被自动更新. 通常讲就是被观察者向左右观察对象通知其状态的改变,以使得观察者进行相应信息的更新. 代码 ...

  5. java类中的static成员变量和static方法简单介绍,持续补充

    一.静态成员变量 1.属于整个类而不是某个对象实例,所以可以直接通过类名和对象名去调用. 2.静态成员属于整个类,当系统第一次使用该类时,就会为其分配内存空间直到该类被卸载才会进行资源回收 二.静态方 ...

  6. 更有效率的使用 Visual Studio - 快捷键

    工欲善其事,必先利其器.虽然说Vim和Emacs是神器,但是对于使用Visual Studio的程序员来说,我们也可以通过一些快捷键和潜在的一些功能实现脱离鼠标写代码,提高工作效率,像使用Vim一样使 ...

  7. C 语言---漂亮的宏定义

    写好C 语言,漂亮的宏定义很重要,使用宏定义可以防止出错,提高可移植性,可读性,方便性等等.下面列举一些成熟软件中常用得宏定义. 1.防止一个头文件被重复包含 #ifndef COMDEF_H #de ...

  8. WPF & ArcGIS Engine三维开发入门攻略

    原文 http://www.cnblogs.com/Realh/archive/2010/12/14/1906112.html 前些日子在做ESRI的开发大赛,从刚开始接触ArcGIS Engine( ...

  9. Linux下的命令行上网

    对于网页浏览器现在大多数人用links/elinks,对了,还有个老牌一点的文本浏览器Lynx,links/elinks也是从Lynx中fork出来的. 以上所说的虽然能字符界面来浏览网页,但是不能显 ...

  10. 简单了解下Dubbo

    1. Dubbo是什么? Dubbo是一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案.简单的说,dubbo就是个服务框架,如果没有分布式的需求,其实是不需 ...