1. 程式人生 > >hdu_1004 Let the Balloon Rise

hdu_1004 Let the Balloon Rise

iter int ++ tro gin cin urn () its

#include<bits/stdc++.h>
using namespace std;
int n,vmax;
string x,smax;
map<string,int> m;
map<string,int>::iterator p;

int main(){
    while(scanf("%d",&n) && n!=0){
        m.clear();
        vmax=0;
        while(n--){
            cin>>x;
            if(m.find(x)==
m.end())m[x]=1; else m[x]++; } for(p=m.begin();p!=m.end();p++){ if(p->second>vmax){ vmax=p->second; smax=p->first; } } cout<<smax<<endl; } return 0; }

hdu_1004 Let the Balloon Rise