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. (原+转)VS2013:正在从以下位置加载符号

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5158020.html 这段时间启动调试时,vs2013加载时间很长很长...然后下面网址给出了解决方法 ...

  2. PDO基础知识

    使用PDO之前首先开启PHP的PDO扩展,方法见百度. PDO连接数据库的方式有三种 1.通过参数的形式连接数据库 (推荐) //通过参数形式连接数据库 try{ $dsn = 'mysql:host ...

  3. mysql 获取全局唯一值

    在涉及数据库存储数据的时候,经常会遇到唯一值问题,有的是主键带来的限制,有的则是业务上的需要. 下面介绍几种唯一值的获取或者生产方法: 先建一个测试用的表tbl_user,有三个字段:Id.Name. ...

  4. oc语言--内存管理

    一.基本原理 1.什么是内存管理 1> 移动设备的内存及其有限,每个app所能占用的内存是有限制的 2> 当app所占用的内存较多时,系统就会发出内存警告,这是需要回收一些不需要的内存空间 ...

  5. mysql 事务控制

    #!/usr/bin/perl use DBI; $db_name='zjzc'; $ip='127.0.0.1'; $user="root"; $passwd="123 ...

  6. C语言的本质(35)——共享库

    库用于将相似函数打包在一个单元中.然后这些单元就可为其他开发人员所共享,并因此有了模块化编程这种说法- 即,从模块中构建程序.Linux支持两种类型的库,每一种库都有各自的优缺点.静态库包含在编译时静 ...

  7. C语言的本质(33)——GCC编译器入门

    GCC(GNU CompilerCollection,GNU编译器套装),是由 GNU 开发的编程语言编译器.它是以GPL许可证所发行的自由软件,也是 GNU计划的关键部分.GCC原本作为GNU操作系 ...

  8. 项目中Spring注入报错小结

    之前在做单元测试时采用注解方式进行service对象的注入,但运行测试用例时对象要注入的service对象总是空的,检查下spring配置文件,我要配置的bean类xml文件已经包含到spring要加 ...

  9. java MD5加密

    public final static String MD5(String s)    {        char hexDigits[] =        { '0', '1', '2', '3', ...

  10. 【转】android 物理按键

    关键词:android   按键  矩阵按键 AD按键  平台信息: 内核:linux2.6/linux3.0 系统:android/android4.0 平台:S5PV310(samsung exy ...