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>

#include <iostream>
#include <algorithm>

#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <cstring>
#include <string>
#include <utility>
#include <array>
#include <complex>
#include <valarray>

#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>

#include<memory>


using namespace std;
#define int long long

typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double,int> pdi;
typedef pair<long double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;
const ll mod = 1000000000 + 7;
//const ll mod = 998244353;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const long double pi = 3.141592653589793;

#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod
#define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false

//debug
#define DEBUG

#define DUMPOUT cout

#ifdef DEBUG
#define dump(...) DUMPOUT<<#__VA_ARGS__<<" :["<<__FUNCTION__<<":"<<__LINE__<<"]"<<endl; DUMPOUT<<"    "; dump_func(__VA_ARGS__)
#else
#define dump(...)
#endif

void dump_func() {DUMPOUT << endl;};

template <class Head, class... Tail> void dump_func(Head&& head, Tail&&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) == 0) DUMPOUT << " ";
    else DUMPOUT << ", ";
    dump_func(std::move(tail)...);
}

//ostream
template<typename T> ostream& operator << (ostream& os, vector<T>& vec) {
    os << "["; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "]";
    return os;
}

template<typename T, typename U> ostream& operator << (ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}

template<typename T, typename U> ostream& operator << (ostream& os, map<T, U>& map_var) {
    os << "[";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")"; itr++;  if(itr != map_var.end()) os << ", "; itr--;
    }
    os << "]";
    return os;
}

template<typename T> ostream& operator << (ostream& os, set<T>& set_var) {
    os << "[";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr; ++itr; if(itr != set_var.end()) os << ", "; itr--;
    }
    os << "]";
    return os;
}

int a[105];
vector<int> cnt(101, 0);
vector<int> ans;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int i = 0;
  while(true) {
    cin >> a[i];
    //cout << a[i-1] << endl;
    if (cin.eof()) break;
    cnt[a[i++]]++;
  }
  int mx = 0;
  rep2(j, 1, 101) {
    //cerr << j << " " << cnt[j] << endl;
    if (mx < cnt[j]) {
      ans.clear();
      mx = cnt[j];
      ans.push_back(j);
    }
    else if (mx == cnt[j]) {
      ans.push_back(j);
    }
  }
  rep(j, ans.size()) cout << ans[j] << endl;
}

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

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

int mode[200];
int z,maxs;

int main()
{
	maxs=0;
	for(int a=0;a<199;a++)
	{
		mode[a]=0;
	}
	while(scanf("%d",&z)!=EOF)
	{
		if(z<0)
		{
			break;
		}
		mode[z]++;
		maxs=max(maxs,mode[z]);
	}
	for(int a=0;a<199;a++)
	{
		if(mode[a]==maxs)
		{
			printf("%d\n",a);
		}
	}
	return 0;
}

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

int main(int argc, char* argv[]) {
  map<int, int> data;
  int var;
  int max = 0;
  while(cin >> var) {
    data[var]++;
    if(data[var] > max) {
      max = data[var];
    }
  }
  //cout << max << endl;
  for(map<int, int>::iterator it=data.begin(); it!=data.end(); it++) {
    if(it->second == max) cout << it->first << endl;
  }
}

C++: #include <iostream>

using namespace std;

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

C++: #include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;

int main(void){
	int n,a[101],m=0;
	rep(i,1,101){
		a[i]=0;
	}
	while( cin >> n ){
		a[n]++;
	}
	rep(i,1,101){
		if(m < a[i]){
			m=a[i];
		}
	}
	rep(i,1,101){
		if(m == a[i]){
			cout << i << "\n";
		}
	}
	return 0;
}

C++: #include<stdio.h> 
short f[100];short ans=0;short n;int main(){while(scanf("%d",&n)!=EOF){f[n-1]++;if(f[ans]<f[n-1]){ans=n-1;}}printf("%d\n",ans);}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(void)
{
	int a[101]={0},i,n,s=0;
	while(cin>>n){
	a[n]++;
		if(a[n]>s){
			s=a[n];
		}
	}
	for(i=1;i<=100;i++){
		if(s==a[i]){
		cout<<i<<endl;
		}
	}
	return 0;
}

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

int appear[100];

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