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>

int answer[101];

int main(int argc, char const* argv[])
{
	int input;

	for( int i = 0;i < 101;i++ ) answer[i] = 0;

	while( std::cin >> input ){
		answer[input]++;
	}

	int max = 0;

	for( int i = 1;i < 101;i++ ){
		max = std::max( answer[i], max );
	}


	for( int i = 1;i < 101;i++ ){
		if( answer[i] == max ) std::cout << i << std::endl;
	}

	return 0;
}

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

int main(){
	int z[101];
	int i, mode;
	
	for(int j = 0; j < 101; j++) z[j] = 0;
	
	while((scanf("%d", &i)) != EOF) z[i]++;
	
	mode = 0;
	for(int j = 1; j < 101; j++) mode = max(mode, z[j]);
	
	for(int j = 1; j < 101; j++){
		if(z[j] == mode) printf("%d\n", j);
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    int counter[101];
    int buffer, i, max = 0;

    // 0埋め
    for(i = 1; i <= 100; i++) counter[i]= 0;

    while(cin >> buffer) counter[buffer]++;

    // カウントアップしようね
    for(i = 1; i <= 100; i++)
        max = counter[i] >= max ? counter[i] : max;

    // Modeを表示する
    for(i = 1; i <= 100; i++) {
        if(counter[i] != max) continue;
        cout << i << endl;
    }
}

C++: #include <iostream>

int main(){
	int a,c=0,t=0;
	int b[100],f[100],z[100];
	z[0]=0;
	while(std::cin>>a){
         c++;
	    b[c]=a;
	}
	for(int g=1;g<=100;g++){
		f[g]=0;
	}
	for(int d=1;d<=c;d++){
			f[b[d]]++;
			}
	for(int g=1;g<=100;g++){
		
			if(f[g]>z[0]){
				for(int l=0;l<=t;l++){
				z[l]=0;
			}
			z[0]=g;
				t=0;
			}else if(f[g]==z[0]){
				for(int l=0;l<=t;l++){
				if(g<z[l]){
					for(int da=t;da>=l;da--){
						z[da+1]=z[da];
					}
					z[l]=g;
					
				}
				
			}t++;
		}
	}
	for(int p=0;p<=t;p++){
		std::cout<<z[p]<<std::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 num;
	int appear[101];
	int max;
	/*****処理部*****/
	max = 0;
	for(int i=0;i<101;i++)	appear[i] = 0;
	while(1){
		cin >> num;
		if(cin.eof())	break;
		//cin >> num;
		appear[num] += 1;
	}
	cout << endl;
	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>

#define SIZE 100

using namespace std;

int main() {
	int value[SIZE], n, max = 0;


	while (cin >> n) {
		value[n - 1]++;

		if (value[n - 1] > max) max = value[n - 1];
	}

	for (int i = 0; i < SIZE; i++) {
		if (value[i] == max) {
			cout << i + 1 << endl;
		}
	}

	return 0;
}

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

int main()
{
	std::vector<int> hist(100, 0);

	int index = 0;
	int max = 0;
	while (std::cin >> index)
	{
		hist[index - 1]++;
		if (max < hist[index - 1])
		{
			max = hist[index - 1];
		}
	}

	int i = 1;
	for (const auto& h : hist)
	{
		if (h == max)
		{
			std::cout << i << std::endl;
		}
		++i;
	}

	return 0;
}

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

int main(){
	int most, n;
	int array[101] = {0};
	most = 0;
	while(cin >> n){
		array[n]++;
		if(most < array[n]){
			most = array[n];
		}
	}
	for(int i=1; i<=100; i++){
		if(array[i] == most){
			cout << i << endl;
		}
	}
	return 0;
}