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++: //aoj0028
#include<iostream>
#include<algorithm>
using namespace std;

int ar[120] = {};
int b[120] = {};

int main() {
	int n;
	int ca = 0;
	while (cin >> n) {
		ar[n - 1]++;
		b[n - 1]++;
		ca++;
	}

	sort(b, b + ca);
	int max = b[ca - 1];
	for (int i = 0; i < ca; i++) {
		if (ar[i] == max) {
			cout << i+1 << endl;
		}
	}
	return 0;
}

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

using namespace std;

int main(){
  int input=0;
  int a[100];
  int b[100][2];
  for(int i=0;i<100;i++){
    for(int j=0;j<2;j++){
      b[i][j]=0;
    }
  }
  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][0]==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>
using namespace std;

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

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

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

C++: #include<iostream>
using namespace std;
int main() {
	int a, b[111], i, z, dai;
	dai = 0;
	i = 1;
	for (i = 1; i <= 100; i++) {
		b[i] = 0;
	}
	while (cin >> a) {
		b[a]++;
	}
	for (i = 1; i <= 100; i++) {
		if (dai < b[i]) {
			dai = b[i];
		}
	}
	for (i = 1; i <= 100; i++) {
		if (dai == b[i]) {
			cout << i << endl;
		}
	}
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n,num[110]={},x,ans1=0,ans2=0;
	vector<int> ans;
	while(cin>>n)	num[n]++;
	for(int i=1;i<=100;i++){
		if(num[i]>ans2){
			ans.clear();
			ans.push_back(i);
			ans2 = num[i];
		}
		else if(num[i]==ans2)	ans.push_back(i);
	}
	for(int i=0;i<ans.size();i++)	cout << ans[i] << endl;
	return 0;
}

C++: #include <bits/stdc++.h>

#define SIZE 300005
#define MOD 1000000007LL
#define INF INT_MAX / 3
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define FORALL(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef valarray<int> Array;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cout<<a[i];if(i==a.size()-1)cout<<endl;else cout<<" ";}}
int gcd(int a,int b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
int lcm(int a,int b){return a==0||b==0?0:a*b/gcd(a,b);}

int main()
{
  vector<int> a(101,0);
  int x, tmp = 0;
  while(~scanf("%d",&x)) a[x]++;
  vector<int> ans;
  FOR(i,1,100)
  {
    if(a[i] > a[tmp])
    {
      tmp = i;
      ans.clear();
      ans.push_back(tmp);
    }
    else if(a[i] == a[tmp])
      ans.push_back(i);
  }
  for(auto v : ans) printf("%d\n",v);
  return 0;
}

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

using namespace std;

int main() {
    int modecnt = 0;
    map<int, int> m;
    int n;
    while(cin >> n) 
        modecnt = max(modecnt, ++m[n]);

    vector<int> ans;
    for(map<int,int>::iterator it = m.begin(); it != m.end(); ++it)
        if(it->second == modecnt) ans.push_back(it->first);
    sort(ans.begin(), ans.end());
    for(int i = 0; i < ans.size(); ++i)
        cout << ans[i] << endl;

    return 0;
}

C++: #include<iostream>
using namespace std;
#include<stdio.h>
int data[101];
void format(){
int i;
for(i=100;i--;){
data[i]=0;
}
}
int main(){
format();
int i;
while((scanf("%d",&i))!=EOF){
data[i]++;
if(data[0]<data[i]){
data[0]=data[i];
}
}
for(i=100;i--;){
if(data[100-i]==data[0]){
printf("%d\n",100-i);
}
}
return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int N, A[101], i = 0, max = 0;

	for (int i = 0; i < 100; i++) { A[i] = 0; }

	while (cin >> N)
	{
		i++;

		A[N]++;
	}

	for (int j = 1; j <= 100; j++)
	{
		if (A[j] > max) { max = A[j]; }
	}

	for (int j = 1; j <= 100; j++)
	{
		if (A[j] == max) { cout << j << endl; }
	}

	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	int d[101] = {0}, in;

	while(cin >> in)
		d[in]++;
	
	int res = 0;
	vint nums;

	REP(i, 1, 101)
	{
		if(res < d[i])
		{
			nums.clear();
			nums.push_back(i);
			res = d[i];
		}
		else if(res == d[i])
			nums.push_back(i);
	}

	rep(i, nums.size())
		cout << nums[i] << endl;
}

C++: #include <iostream>

using namespace std;
int main(void){
    // Here your code !

int n,a[100];
int b=0;
for(int i=0;i<100;i++){
    a[i]=0;
}

while(cin>>n){
a[n]++;
}

for(int i=0;i<100;i++){
   b=max(b,a[i]);
}
for(int i=0;i<100;i++){
if(b==a[i]) cout<<i<<endl;
}



}

C++: #include <iostream>

using namespace std;

int freq[100];

int main () {
  int n;
  int index_mode = 0;

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

  for(int i = 0; i < 100; i++){
    if (freq[i] > freq[index_mode])
      index_mode = i;
  }

  for(int i = 0; i < 100; i++){
    if (freq[i] == freq[index_mode])
      cout << i+1 << endl;
  }
}