Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

type Pair struct {
	key   int
	value int
}

func main() {
	scanner.Split(bufio.ScanWords)

	counts := map[int]int{}
	for {
		n, err := nextInt()
		if err != nil {
			break
		}

		counts[n]++
	}

	pairs := []Pair{}
	for k, v := range counts {
		pairs = append(pairs, Pair{k, v})
	}
	sort.Slice(pairs, func(i, j int) bool {
		if pairs[i].value == pairs[j].value {
			return pairs[i].key < pairs[j].key
		}
		return pairs[i].value > pairs[j].value
	})

	vMax := 0
	for _, pair := range pairs {
		if vMax != 0 && vMax != pair.value {
			break
		}
		if pair.value > vMax {
			vMax = pair.value
		}
		fmt.Println(pair.key)
	}
}

C++: #include<iostream>

using namespace std;
int main(){
	int a[101]={0},n=0,saidai[100]={0},m=0;
	while(cin>>n){
		a[n]++;
	}
	for(int i=1;i<101;i++){
		if(saidai[m]<a[i]){
			for(int x=0;x<=m;x++){
				saidai[x]=0;
				m=0;
			}
			saidai[m]=i;
		}
		else if(saidai[m]==a[i]){
			saidai[m+1]=saidai[m];
			saidai[m]=i;
			m++;
		}
	}
	for(int i=0;i<=m;i++){
		for(int y=m;y>i;y--){
			if(saidai[i]>saidai[y]){
				int t=0;
				t=saidai[i];
				saidai[i]=saidai[y];
				saidai[y]=t;
			}
		}
		if(saidai[i]!=0){
			cout<<saidai[i]<<endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <climits>
#include <cstring>
using namespace std;

int main(void) {
    int input;
    int mode[1000];
    memset(mode, 0, sizeof(mode));
    int max = INT_MIN;
    while(cin >> input) {
        mode[input]++;
        if(mode[input] > max) max = mode[input];
    }
    for(int r = 0; r < 1000; r++) {
        if(mode[r] == max) cout << r << endl;
    }
    
    return(0);
}

C++: #include <iostream>
#include <algorithm>
#include <stdio.h>

using namespace std;

int main(){
	int ary[100];
	int hikaku[100];
	int n;
	int a = 0;
	
	for(int i = 1; i <= 100; i++){
		ary[i] = i;
		hikaku[i] = 0;
	}

	while(scanf("%d",&n) != EOF){

		for(int i = 1; i <= 100; i++){

			if(ary[i] == n){
				hikaku[i]++;
				a = max(a,hikaku[i]);
			}
		}

	}

	for(int i = 1; i <= 100; i++){
		
		if(a == hikaku[i]){
			cout << i << endl;
		}
	}
	cout << endl;

	return 0;
}

C++: #include <iostream>

int main(){
	int a,c=0,t=0;
	int b[101],f[101],z[101],x[101];
	z[0]=0;
	
	while(std::cin>>a){
         c++;
	    b[c]=a;
	}
	for(int g=1;g<=100;g++){
		f[g]=0;
		z[g]=0;
	}

	for(int d=1;d<=c;d++){
			f[b[d]]++;
			}
	
	for(int g=1;g<=100;g++){
		
			if(f[g]>z[0]){
			
			z[0]=f[g];
			x[0]=g;
				t=0;
			}else if(f[g]==z[0]){
				t++;
			
				x[t]=g;
		}
	}
	
	for(int p=0;p<=t;p++){
		std::cout<<x[p]<<std::endl;
	}
	return 0;
		}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	vector<int> vec(100); vector<int> cop; int temp;
	fill(vec.begin(), vec.end(), 0);
	while (cin >> temp) vec[temp - 1]++;
	copy(vec.begin(), vec.end(), back_inserter(cop));
	sort(cop.begin(), cop.end(), greater<int>());
	for (int i = 0; i < 100; i++)
		if (vec[i] == cop[0]) cout << i + 1 << endl;
	return 0;
}

C++: #include <iostream>
using namespace std;

int main(){
  int hist[100];
  for(int i=0; i<100;i++) hist[i] = 0;
 
  int n;
  while(cin >> n) hist[n]++;
  
  int maxv = 0;
  for(int i=0;i<100;i++){
    if(ans[i] >  maxv) maxv = ans[i];
  }
  
  for(int i=0;i<100;i++){
    if(maxv == hist[i]) cout << i << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int a[101] = {0};
  int n;
  int aa = 0;
  while(cin >> n) {
    a[n]++;
    aa = max(aa,a[n]);
  }
  REP(i,101) {
    if (a[i]==aa) cout << i << endl;
  }
}

C++: #include<iostream>
using namespace std;

int main(){

  int a, cnt[101]={}, maxn=0;

  while(cin>>a){
    cnt[a]++;
    maxn=max(maxn, cnt[a]);
  }

  for(int i=1;i<=100;i++){
    if(maxn==cnt[i]) cout<<i<<endl;
  }

  return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int num[110] = {0};
	int n;
	int M = 0, ct = 0;
	
	while (cin >> n){
		num[n]++;
		ct++;
		M = max(M, num[n]);
	}
	
	for (int i = 0; i < ct; i++){
		if (M == num[i]){
			cout << i << "\n";
		}
	}
	return (0);
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<numeric>
#include<vector>
#include<limits.h>
#include<float.h>
#define foreach(t,p) for(t::iterator it=p.begin();it!=p.end();++it)
#define rforeach(t,p) for(t::reverse_iterator it=p.begin();it!=p.rend();++it)
#define all(p) p.begin,p.end()
using namespace std;
typedef pair<int,int> pp;

int main()
{
    int times[110]={0};
    int n;
    while(cin>>n){times[n]++;if(cin.eof())break;}
    
    set<pp,greater<pp> > kaisu;
    for(int i = 1;i<101;i++)
    {
        kaisu.insert(pp(times[i],i));
    //    cout << i << " "<< times[i] << endl;
    }

    n=(*kaisu.begin()).first;
    set<pp>::iterator pit;
    set<int> outs;
    for(pit=kaisu.begin();(*pit).first==n;++pit)
    {
        outs.insert((*pit).second);
        //cout << (*pit).second << endl;
    }
        //    cout << (*it).second << endl;
        //
    //cout << *(outs.begin()) << endl;
    foreach(set<int>,outs)cout << *it << endl;
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int intager[100]={0};
  int num;
  while(cin>>num)
    intager[num-1]++;
  int flag=0;
  for(int i=100;i>0;i--)
    for(int j=0;j<100;j++)
      if(intager[j]==i)
	cout<<j+1<<endl;
  return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
int a[103];
int b[103];
for(int i=0;i<100;i++){
b[i]=1;}
int ans[103];
int small[103];
int d=0;
int big=0;
int c=0;
//入力
while(cin>>a[c]){c++;}
//重複の削除
for(int i=0;i<c;i++){
for(int j=i+1;j<c;j++){
if(a[i]==a[j]){
b[i]++;
c--;
for(int k=j;k<c;k++){
a[k]=a[k+1];}
}}}
//最頻値の出る回数
for(int i=0;i<c;i++){
if(b[i]>big){big=b[i];}}
//最頻値リスト
for(int i=0;i<c;i++){
if(b[i]==big){
ans[d]=a[i];
d++;}}
//以上ok
//昇順に直す
small[0]=ans[0];
for(int i=1;i<d;i++){
for(int j=i-1;j>-1;j--){
if(small[j]<ans[i]){
for(int k=i;k>j+1;k--){
small[k]=small[k-1];}
small[j+1]=ans[i];
break;}}
if(ans[i]<small[0]){
for(int j=i;j>0;j--){
small[j]=small[j-1];}
small[0]=ans[i];}
}
//出力
for(int i=0;i<d;i++){
cout<<small[i]<<endl;}}

C++: #include <iostream>
#include <array>
#include <vector>

constexpr int MAX = 100;

int main()
{
    std::array<int, MAX + 1> cnt = {0};

    int key;
    while (std::cin >> key) {
        cnt.at(key)++;
    }

    std::vector<int> modes;
    int mode = 0;
    for (auto key = 1; key <= MAX; key++) {
        if (cnt.at(key) == mode) {
            modes.push_back(key);
        } else if (cnt.at(key) > mode) {
            mode = cnt.at(key);
            modes.clear();
            modes.push_back(key);
        }
    }

    for (auto i = 0; i < modes.size(); i++) {
        std::cout << modes.at(i) << std::endl;
    }

    return 0;
}

C++: #include <iostream>
using namespace std;


int main(){

	int n,max=1,x[101]={0};
	
	while (scanf("%d",&n)!=EOF) {
		x[n]++;
	}
	
	for (int i=0; i<101; i++) {
		if (max<x[i]) {
			max=i;
		}
	}
	cout << max << endl;
	
	for (int i=max+1; i<101; i++) {
		if (x[max]==x[i]) {
			cout << i <<endl;
		}
	}
		
	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,cnt[100];
	int i,j,x,max;
	x=0;
	for(i=0;i<101;i++) cnt[i]=0;
	while(scanf("%d",&n)!=EOF) {
		cnt[n]++;
		x++;
	}
	max=-1;
	for(i=0;i<x;i++) {
		if(max<cnt[i]) max=cnt[i];
	}
	for(i=0;i<x;i++) {
		if(max==cnt[i]) printf("%d\n",i);
	}
	return 0;
}