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<bits/stdc++.h>
using namespace std;
int main(void){
    int n[100],cou[50],num=0,num2=0,moo[50],cou2=0;
    for(int i=0;i<100;i++){
        cin>>n[i];
    }
    for(int i=0;i<100;i++){
        if(0<n[i]&&n[i]<101){
        num++;
        }
    }
    for(int i=0;i<num-1;i++){
        cou[i]=0;
        for(int j=i+1;j<num;j++){
            if(n[i]==n[j]){
               cou[i]++;
               moo[i]=n[i];
            }
        }
    }
    for(int i=0;i<50;i++){
        if(0<cou[i]&&cou[i]<51){
           num2++;
        }
    }    
    for(int i=0;i<num2-1;i++){
        for(int j=0;j<num2-i-1;j++){
            if(cou[j]<cou[j+1]){
                swap(cou[j],cou[j+1]);
                swap(moo[j],moo[j+1]);
            }
        }
    }
    for(int i=0;i<num2;i++){
        if(moo[i]!=moo[i+1]){
            break;
        }
        cou2++;
    }
    for(int i=0;i<cou2-1;i++){
        for(int j=0;j<cou2-i-1;j++){
            if(moo[j]>moo[j+1]){
                swap(moo[j],moo[j+1]);
            }  
        }
    }
    for(int i=0;i<cou2;i++){
        cout<<moo[i]<<endl;
    }
}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>
#include <utility>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
using namespace std;

Int aa[120];

int main(){
	int a  = -1;
	while (cin >> a,a!=-1){
		++aa[a];
	}

	Int b = 0;

	REP(i, 120){
		b = max(b, aa[i]);
	}

	REP(i, 120){
		if (aa[i] == b)
			cout << i << endl;
	}

	return 0;
}

C++: #include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(int a=0;a<t;a++) 
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
int a[101];
for(int i=0;i<101;i++){a[i]=0;}
int n;
while(cin>>n){
a[n]++;
}
int ans=0;
for(int i=1;i<101;i++){
ans=max(ans,a[i]);
}
for(int i=1;i<101;i++){
if(a[i]==ans){cout<<i<<endl;}
}
	return 0;
}

C++: /*****include*****/
#include <iostream>
#include <fstream>
#include <string>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return 0;
	}
#endif
	/*****変数置き場*****/
	int i=0;
	int num;
	int appear[101];
	int max;
	/*****処理部*****/
	max = 0;
	for(int i=0;i<101;i++)	appear[i] = 0;
	while(!cin.eof()){
		cin >> num;
		//cin >> num;
		appear[num] += 1;
	}
	for(int i=0;i<101;i++)
		if(appear[i] > max)	max = appear[i];
	for(int i=0;i<101;i++)
		if(appear[i] == max)
			cout << i << endl;
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

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

int main() {
	int num[100] = {};
	int n;
	while (cin >> n) {
		num[n - 1]++;
	}
	int max = 0;
	for (int i = 0; i < 100; i++) {
		if (num[i] > max) max = num[i];
	}
	for (int i = 0; i < 100; i++) {
		if (num[i] == max) cout << i + 1 << endl;
	}
}

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

int main() {
	int n;
	int kai[101]={0};
	while(cin>>n){
		kai[n]++;
	}
	
	int max=0;
	for(int i=0; i<101; ++i){
		if(max<kai[i])max=kai[i];
	}
	for(int i=0; i<101; ++i){
		if(max==kai[i])cout<<i<<endl;
	}
	return 0;
}

C++: #include<iostream>

int main() {
	int vals[101] = { 0 }, val;
	while (std::cin >> val) {
		vals[val] += 1;
	}
	int max = 0;
	for (int i = 1; i <= 100; ++i) {
		if (max < vals[i]) {
			max = vals[i];
		}
	}
	for (int i = 1; i <= 100; ++i) {
		if (vals[i] == max) std::cout << i << std::endl;
	}
	return 0;
}

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

int main(void)
{
	std::vector<int> data;

	int n;

	while(std::cin >> n)
	{
		data.push_back(n);
	}

	std::vector<int> count(data.size());

	for(size_t i=0; i<data.size(); ++i)
	{
			for(size_t j=0; j<data.size()-i; ++j)
		{
			if(data[i]==data[i+j])
			{
				++count[i];
			}
		}

	}

	count.push_back(0);//ここまででdataのサイズとcountのサイズは同じはずだが、count[i]とcount[i+1]の比較があるのでcountのサイズを一つ大きくしておく Max(count)!=0のはずなので0を入れておけば結果に問題はない

	int countmax = *std::max_element(count.begin(),count.end());

	std::vector<int> answer;
	
	for( size_t i=0; i<count.size(); ++i )
	{
		if(count[i]==countmax)
		{
			answer.push_back(data[i]);
		}
	}
	
	std::sort(answer.begin(),answer.end());

	for( size_t i=0; i<answer.size(); ++i)
	{
		std::cout << answer[i] << '\n';
	}
}

C++: #include <iostream>
#include <algorithm>
#include <deque>
#include <functional>
using namespace std;
int main(){
	int data[150]={0},cp[150]={0},t,cnt=1,max,i=0;
	while(cin>>t){
		data[t]++;
		cnt++;
	}
	for(i=0;i<cnt;i++){
		cp[i]=data[i];
	}
	sort(data,data+150,greater<int>());
	for(int j=0;j<cnt;j++){
		if(data[0]==cp[j]){
			cout<<j<<endl;
		}
	}
return 0;
}

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

using namespace std;

int main(void) {
    int a, n[100], max;
    stack<int> mode;
    
    for (int i = 0; i < 100; i++) {
        n[i] = 0;
    }
    while (cin >> a) {
        n[a - 1]++;
    }
    max = n[99];
    mode.push(99);
    for (int i = 98; i >= 0; i--) {
        if (n[i] > max) {
            while (!mode.empty()) {
                mode.pop();
            }
            max = n[i];
            mode.push(i);
        } else if (n[i] == max) {
            mode.push(i);
        }
    }
    while (!mode.empty()) {
        cout << mode.top() + 1 << endl;
        mode.pop();
    }
    return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <map>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;

int main()
{
	map<int, int> m;
	int a;
	int best = 0;
	while(scanf("%d", &a) != EOF){
		if(m.count(a))
			m[a]++;
		else
			m[a] = 1;
		best = max(best, m[a]);
	}

	for(map<int,int>::iterator itr = m.begin(); itr != m.end(); ++itr)
		if(itr->second == best)
			printf("%d\n", itr->first);

	return 0;
}

C++: #include <stdio.h>
#include <string.h>

int n ;
int p ;
int max ;
int ans[110] ;
int count[110] ;

int main ( )
{
	memset ( count , 0 , sizeof ( count ) ) ;
	max = 1 ;
	p = 0 ;
	while ( scanf ( "%d" , &n ) == 1 ) {
		count[n]++ ;
	}
	for ( int i = 0 ; i < 110 ; i++ ) {
		if ( count[i] > max ) {
			max = count[i] ;
			p = 0 ;
			ans[p++] = i ;
		}
		else if ( count[i] == max ) {
			ans[p++] = i ;
		}
	}
	for ( int i = 0 ; i < p ; i++ ) {
		printf ( "%d\n" , ans[i] ) ;
	}
	return 0 ;
}