//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;
}

相关文章:

  • 2021-06-02
  • 2022-01-11
  • 2022-12-23
  • 2022-03-03
  • 2022-02-10
  • 2021-11-05
  • 2021-12-29
猜你喜欢
  • 2022-01-21
  • 2021-06-15
  • 2021-09-18
  • 2022-12-23
相关资源
相似解决方案