hdu 1004 Let the Balloon Rise

 

//C++容器练习题

#include<iostream>
#include<string>
#include<map>
using namespace std;
int
main(void)
{

    map<string,int> Ballon;
    string color,Maxcolor;
    int
n,max;
    while
(cin>>n,n)
    {

        Ballon.clear();
        while
(n--)
        {

            cin>>color;
            Ballon[color]++;
        }

        map<string,int>::iterator it;
        max=0;
        for
(it=Ballon.begin();it!=Ballon.end();it++)
            if
(it->second > max){
                max=it->second;   //指向整数
                Maxcolor=it->first;  //指向字符串
            }

           cout<<Maxcolor<<endl;
    }

    return
0;
}

posted @ 2013-09-11 19:26  heaventouch  阅读(94)  评论(0编辑  收藏  举报