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<cstdio>

using namespace std;

int main(void){
	int in[100],data,ans[100],cnt,work=0;
	int i,j;	//ループカウンタ

	for(i=0;i<100;i++){
		ans[i]=0;
		in[i]=0;
	}

	for(i=0;i<100;i++){
		if(scanf("%d",&data)==EOF)	break;	//EOF=Ctrl+z
		in[data]++;
	}
	
	for(i=1;i<100;i++)
		if(in[work]<in[i])	work=i;
	
	ans[0]=work;
	cnt=0;
	for(i=1;i<100;i++){
		if(in[work]==in[i] && i!=work){
			cnt++;
			ans[cnt]=i;
		}
	}

	for(i=0;i<=cnt-1;i++){
		for(j=1;j<=cnt;j++){
			if(ans[i]>ans[j]){
				work=ans[i];
				ans[i]=ans[j];
				ans[j]=work;
			}
		}
	}
	
	for(i=0;i<=cnt;i++)
		printf("%d\n",ans[i]);

	return 0;
}

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

using namespace std;

int main (void) {
    int t[100] = {0}, m = 0;
    while (1) {
        int n;
        cin >> n;
        if (cin.eof()) break;
        t[n - 1]++;
        m = max(m, t[n - 1]);
    }
    for (int i = 0; i < 100; i++) {
        if (t[i] == m) {
            cout << (i + 1) << endl;
        }
    }
    return 0;
}

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

int main(){
  int n;
  int max=0;
  int seq[100];
  int i;

  for(i=0; i<100; i++) seq[i]=0;
  while(cin>>n){
    seq[n]++;
    if(max<seq[n]) max=seq[n];
  }
  for(i=0; i<100; i++)
    if(seq[i]==max) printf("%d\n", i);

  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<<z[p]<<std::endl;
	}
	return 0;
		}

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

#define N 100

int main(void){

	int i;
	int input, max = 0;
	int bucket[N + 1];

	// テゥツ?催・ツ按療」ツ?ョテ・ツ按敕ヲツ慊淌・ツ個?
	for (int i = 0; i < N + 1; i++){
		bucket[i] = 0;
	}

	// テ・ツ?・テ・ツ環崚」ツ?ォテ」ツ?療」ツ?淌」ツ?古」ツ?」テ」ツ?ヲテゥツ??ヲツャツ。テゥツ?催・ツ按療」ツつ津」ツつォテ」ツつヲテ」ツδウテ」ツδ暗」ツつ「テ」ツδε」ツδ?
	while (cin >> input){
		bucket[input]++;
	}

	// テ」ツつづ」ツ?」テ」ツ?ィテ」ツつづ・ツ、ツ堙」ツ?湘・ツ?コテ」ツ?淌・ツ崢榲ヲツ閉ーテ」ツつ津ヲツアツづ」ツつ?」ツつ?
	for (int i = 0; i < N + 1; i++){
		if (max < bucket[i]){
			max = bucket[i];
		}
	}

	// テ」ツ?敕」ツ?ョテ・ツ崢榲ヲツ閉ーテ」ツ??」ツ?妥・ツ?・テ・ツ環崚」ツ?陛」ツつ古」ツ?淌ヲツ閉ーテ・ツ?、テ」ツつ津・ツ?コテ・ツ環?
	for (int i = 0; i < N + 1; i++){
		if (max == bucket[i]){
			printf("%d\n", i);
		}
	}

	return 0;
}

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

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
#include <complex>
#include <cstring>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  int a[100] = {0};
  int n;
  int len = 0;
  while(cin>>n){
    a[n-1] ++;
  }
  int max = -1;
  vector<int> res;
   rep(i,100){
    if(a[i] > max){
 
      max = a[i];
      res.clear();
      res.pb(i);
    }
    if(a[i] == max)res.pb(i);
  }
  rep(i,res.size())cout<<res[i]+1<<endl;

}

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

#define SAFE_DELETE( x ) { if ( x ){ delete x; x = NULL; } }

struct tCell{
	tCell() : number( 0 ), count( 0 ), prev( NULL ), next( NULL ){}

	int number, count;
	tCell *prev, *next;
};

class Database{
public:
	Database() : size( 0 ), head( NULL ), tail( NULL ){
		head = new tCell;
		tail = new tCell;
		head->next = tail;
		tail->prev = head;
	}
	~Database(){
		init();
		SAFE_DELETE( tail );
		SAFE_DELETE( head );
	}

	void init(){
		for ( int i = size; i > 0; --i ){
			tCell* cell = tail->prev;
			cell->prev->next = cell->next;
			cell->next->prev = cell->prev;
			SAFE_DELETE( cell );
		}
	}
	void store( int n ){
		bool stored = false;
		tCell* cell = head;
		for ( int i = 0; i < size; ++i ){
			cell = cell->next;
			if ( cell->number == n ){
				++cell->count;
				stored = true;
				break;
			}
		}
		if ( !stored ){
			pushBack( n );
		}
	}
	void sort(){
		for ( int i = 0; i < size - 1; ++i ){
			tCell* cell = head;
			tCell* celln = head->next;
			for ( int j = 0; j < size - 1 - i; ++j ){
				cell = celln;
				celln = celln->next;
				if ( cell->number > celln->number ){
					int tn = cell->number;
					int tc = cell->count;
					cell->number = celln->number;
					cell->count = celln->count;
					celln->number = tn;
					celln->count = tc;
				}
			}
		}
	}
	void maxCount( Database& db ){
		int c = 0;
		tCell* cell = head;
		for ( int i = 0; i < size; ++i ){
			cell = cell->next;
			if ( c < cell->count ) c = cell->count;
		}
		db.init();
		cell = head;
		for ( int i = 0; i < size; ++i ){
			cell = cell->next;
			if ( cell->count == c ){
				db.store( cell->number );
			}
		}
	}
	int getSize(){ return size; }
	
	tCell operator[]( int n ){
		tCell* cell = head->next;
		if ( n >= size ){ cell = NULL; return *cell; }
		for ( int i = 0; i < n; ++i ){
			cell = cell->next;
		}
		return *cell;
	}

private:
	void pushBack( int n ){
		++size;
		tCell* cell = new tCell;
		cell->number = n;
		++cell->count;
		cell->prev = tail->prev;
		cell->next = tail;
		cell->prev->next = cell;
		cell->next->prev = cell;
	}

	int size;
	tCell *head, *tail;
};

int main(){
	int n;
	Database db, result;

	while ( cin >> n ){
		db.store( n );
	}

	db.sort();
	db.maxCount( result );
	for ( int i = 0; i < result.getSize(); ++i ){
		cout << result[ i ].number << endl;
	}

	return 0;
}

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

int num[10];
int big = 0;
int input;
int main(){
	for(int i=0; i < 10; i++) num[i]=0;
	while(cin >> input) num[input]++;
	for(int i=0; i < 10; i++) big = max(big, num[i]);
	for(int i=0; i < 10; i++){
		if(num[i] == big){
			cout << i << endl;
		}
	}
}

C++: #include <stdio.h>

int main()
{
	int val[100], val2[100], k, i, j, t, s;

	i = 0;
	while(scanf("%d", &val[i]) != EOF){
		for (j = 0; j <= i; j++){
			if(val[j] > val[i]){
				t = val[j];
				val[j] = val[i];
				val[i] = t;
			}
		}

		i++;
	}

	i = 0;
	j = 1;
	t = 0;
	k = 0;
	s = 1;
	while(val[i] != '\0'){
		if (t == val[i]) j++;
		else{
			if(s == j) {k++; val2[k] = val[i-1];}
			else if(s < j) {s = j; k = 0; val2[k] = val[i-1];}
			t = val[i]; j = 1;
		}

		i++;
	}

	i = 0;
	while(val2[i] != '\0'){
		printf("%d\n", val2[i]);
		i++;
	}

	return 0;
}

C++: #include<iostream>
#define MAX 101
using namespace std;
 
int main()
{
  int n,m=0;
  int c[MAX]={};
 
  while(cin>>n)c[n]++;
  for(int i=0;i<MAX;i++)m=max(m,c[i]);
  for(int i=1;i<MAX;i++)if(m==c[i])cout<<i<<endl;
   
  return 0;
}