#include<iostream>
#include<string>
using namespace std;
struct bal_col
{
string color;
int amount;
};
int main()
{
void reset(bal_col a[]); //重置存储气球颜色的数组
int pop_bal_index(bal_col a[], int);//求含有最受欢迎的气球颜色的数组元素的索引
bal_col a[1000];//定义一个数组来存储输入的气球颜色
reset(a);
int total, i;
string temp;
while(cin>>total && total != 0)
{
int _total = total;
int kinds = 0;//气球颜色种类
while(_total --)
{
cin>>temp;
if(kinds == 0)
{
a[0].color = temp;
a[0].amount = 1;
kinds++;
}
else
{
bool dif_from_all = true;//先假设输入的气球颜色temp与已有的所有气球的颜色都不同
for(i = 0; i < kinds; i++)
{
if(a[i].color == temp)
{
dif_from_all = false;
a[i].amount++;
continue;
}
}
if(dif_from_all) //若不同,则用数组中的下一元素来存储这个颜色
{
a[kinds].color = temp;
a[kinds].amount++;
kinds++;
}
}
}
int POP_INDEX = pop_bal_index(a, kinds);
cout<<a[POP_INDEX].color<<endl;
reset(a);
}
return 0;
}
void reset(bal_col a[])
{
int i;
for(i = 0; i < 1000; i++)
{
a[i].color = " ";
a[i].amount = 0;
}
}
int pop_bal_index(bal_col a[], int n)
{
int j;
int max_amount = 0;
int pop_index = 0;
for(j = 0; j < n; j++)
{
if(a[j].amount > max_amount)
{
max_amount = a[j].amount;
pop_index = j;
}
}
return pop_index;
}
#include<string>
using namespace std;
struct bal_col
{
string color;
int amount;
};
int main()
{
void reset(bal_col a[]); //重置存储气球颜色的数组
int pop_bal_index(bal_col a[], int);//求含有最受欢迎的气球颜色的数组元素的索引
bal_col a[1000];//定义一个数组来存储输入的气球颜色
reset(a);
int total, i;
string temp;
while(cin>>total && total != 0)
{
int _total = total;
int kinds = 0;//气球颜色种类
while(_total --)
{
cin>>temp;
if(kinds == 0)
{
a[0].color = temp;
a[0].amount = 1;
kinds++;
}
else
{
bool dif_from_all = true;//先假设输入的气球颜色temp与已有的所有气球的颜色都不同
for(i = 0; i < kinds; i++)
{
if(a[i].color == temp)
{
dif_from_all = false;
a[i].amount++;
continue;
}
}
if(dif_from_all) //若不同,则用数组中的下一元素来存储这个颜色
{
a[kinds].color = temp;
a[kinds].amount++;
kinds++;
}
}
}
int POP_INDEX = pop_bal_index(a, kinds);
cout<<a[POP_INDEX].color<<endl;
reset(a);
}
return 0;
}
void reset(bal_col a[])
{
int i;
for(i = 0; i < 1000; i++)
{
a[i].color = " ";
a[i].amount = 0;
}
}
int pop_bal_index(bal_col a[], int n)
{
int j;
int max_amount = 0;
int pop_index = 0;
for(j = 0; j < n; j++)
{
if(a[j].amount > max_amount)
{
max_amount = a[j].amount;
pop_index = j;
}
}
return pop_index;
}