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 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;
		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]=g;
				t=0;
			}else if(f[g]==z[0]){
				t++;
				z[t]=g;
		}
	}
	for(int p=0;p<t;p++){
		std::cout<<z[p]<<std::endl;
	}
	return 0;
		}

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

using namespace std;

int main(){
  int input=0;
  int a[100];
  int b[100][2];
  int n=0;
  while(cin>>input){
    a[n]=input;
    n++;
  }
  sort(a,a+n);
  int i=0,j=0;
  for(i=0;i<n;i++){
    if(i=0){
      b[0][0]=a[0];
      b[0][1]++;
    }
    else if(b[j][2]==a[i]){
      b[j][1]++;
    }
    else{
      b[++j][0]=a[i];
      b[j][1]++;
    }
  }
  int max=b[0][1];
  for(int k=0;k<=j;k++){
    if(max<b[k][1]){
      max=b[k][1];
    }
  }
  int out[100];
  int m=0;
  for(int k=0;k<=j;k++){
    if(max==b[k][1]){
      out[m]=b[k][0];
      m++;
    }
  }
  for(int p=0;p<m;p++){
    cout<<out[p]<<"\n";
  }
  return 0;
}

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

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

C++: #include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)

int main(int argc, char **argv)
{
  map<int, int> mode;
  int i;
  for (;;) {
    cin >> i;
    if (cin.eof())
      break;

    mode[i]++;
  }

  int m = 0;
  tr(mode, i) {
    m = max(i->second, m);
  }
  tr(mode, i) {
    if (i->second == m)
      cout << i->first << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a[101]={0},k=0;
  while(cin>>n){
    a[n]++;
    k=max(a[n],n);
  }
  for(int i=1;i<101;i++)if(a[i]==k)cout<<i<<endl;
}

C++: #include <string>
#include <vector>
#include <iostream>
#include <complex>
#include <map>
using namespace std;

typedef vector<int> VI;
#define REP(i,s,t) for(int i=(s);i<(t);i++)

int main() {
    int i;
    map<int, int> count;
    while (cin >> i){
        map<int, int>::iterator it = count.find(i);
        if (it!=count.end()){
            count[i] += 1;
        } else {
            count[i] = 1;
        }
    }
    int mode = 0;
    VI m;
    for (auto it = count.cbegin(); it != count.cend(); ++it){
        if (mode < it->second){
            mode = it->second;
            m.clear();
            m.push_back(it->first);
        }else if (mode == it->second){
            m.push_back(it->first);
        }

    }
    std::sort(m.begin(), m.end());
    for (int num:m){
        cout << num << endl;
    }
    return 0;
}

C++: /*AOJ 0028*/

#include<iostream>
using namespace std;

#define FOR(i,n) for(int i=0;i<n;i++)

int main(){

	int data[100];
	int num;
	int max=0;

	FOR(i,100){
		data[i] = 0;
	}

	while(cin>>num){
		
		if(num == 0){
			break;
		}
		data[num-1]++;
	}

	FOR(i,100){
		if(max<=data[i]){
			max = data[i];
		}
	}

	FOR(i,100){
		if(data[i] == max){
			cout<<i+1<<endl;
		}
	}

	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector <string> VS;
typedef vector <int> VI;
typedef vector <VI> VVI;
template <class T> T gcd( T a, T b ) { return !b ? a : gcd( b, a % b ); }
template <class T> T lcm( T a, T b ){ return a / gcd( a, b ) * b; }
template <class T> string print_v( vector<T> v ) { OSS oss; for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++ it_i ) { oss << *it_i << ", "; } return oss.str(); }

int main() {
    int D[101] = {};
    int a;
    int max_d = 0;
    while ( cin >> a ) max_d = max( max_d, ++D[a] );
    for ( int i = 1; i <= 100; ++ i ) {
        if ( D[i] == max_d ) cout << i << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <map>
#include <cctype>
#include <string>
#include <cstdlib>
#include <math.h>
using namespace std;

#define REP(i,n)  for(int i=0; i<n; i++)

int main()
{
  cout << setprecision(6);
  cout << setiosflags(ios::scientific);
  cout.flags(ios::fixed);

  int counts[100+1];
  memset(counts, 0, sizeof(counts));
  int num=0;
  while(cin >> num){
    counts[num]++;
  }

  int maxNum=0;
  REP(i,101)
    maxNum = max(maxNum,counts[i]);

  REP(i,101){
    if(counts[i]==maxNum){
      cout << i << endl;
    }
  }
}

C++: #include<stdio.h>
int main(){
	int a[101],i=0,j,k=0,t[101]={0};
	while(~scanf("%d",&a[i])){
		i++;}
	for(j=0;j<i;j++)t[a[j]]++;
	for(j=1;j<101;j++)if(k<t[j])k=t[j];
	for(j=1;j<101;j++)if(k==t[j])printf("%d\n",j);
	return 0;}

C++: #include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

const int MAX_N = 100;
int a[MAX_N];
int x;
int mx;

int main()
{
  while(cin >> x) a[x-1] += 1;

  rep(i, MAX_N) maxup(mx, a[i]);

  rep(i, MAX_N) if(mx == a[i]) cout << i + 1 << endl;

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n,MAX=0;
  map<int,int> mp;
  while(cin >> n){
    mp[n]++;
    MAX=max(MAX,mp[n]);
  }
  for(int i=1;i<=100;i++){
    if(mp[i]==MAX){
      cout << i << endl;
    }
  }
  return 0;
}

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;
}