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++: // This is free and unencumbered software released into the public domain.

// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.

// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
// software to the public domain. We make this dedication for the benefit
// of the public at large and to the detriment of our heirs and
// successors. We intend this dedication to be an overt act of
// relinquishment in perpetuity of all present and future rights to this
// software under copyright law.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.

// For more information, please refer to <http://unlicense.org>

/****************/
/* template.hpp */
/****************/

#include <algorithm>
#include <cassert>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <numeric>

using std::abs;
using std::cerr;
using std::cout;
using std::endl;
using std::max;
using std::min;
using std::numeric_limits;
using std::swap;

struct BoolName : std::numpunct<char> {
  std::string t, f;
  BoolName (std::string t, std::string f) : t(t), f(f) {}
  std::string do_truename() const {return t;}
  std::string do_falsename() const {return f;}
};

void set_bool_name(std::string t, std::string f) {
  cout.imbue(std::locale(cout.getloc(), new BoolName(t, f)));
}

struct Initializer {
  Initializer() {
    cout << std::fixed << std::setprecision(15) << std::boolalpha;
    set_bool_name("Yes", "No");
  }
} initializer;

struct Input {
  bool eof;

  Input() : eof(false) {}

  operator char() {
    char v;
    this->eof = (std::scanf("%c", &v) != 1);
    return v;
  }

  operator int() {
    int v;
    this->eof = (std::scanf("%d", &v) != 1);
    return v;
  }

  operator long() {
    long v;
    this->eof = (std::scanf("%ld", &v) != 1);
    return v;
  }

  operator long long() {
    long long v;
    this->eof = (std::scanf("%lld", &v) != 1);
    return v;
  }

  operator double() {
    double v;
    this->eof = (std::scanf("%lf", &v) != 1);
    return v;
  }

  operator long double() {
    long double v;
    this->eof = (std::scanf("%Lf", &v) != 1);
    return v;
  }

  void ignore() const {
    getchar();
  }
} in;

template<typename T> bool chmin(T& a, T b) {return a > b ? a = b, true : false;}

template<typename T> bool chmax(T& a, T b) {return a < b ? a = b, true : false;}

template<typename T, typename S> std::function<S(T)> cast() {
  return [](const T& t) { return static_cast<S>(t); };
}

/*****************/
/* container.hpp */
/*****************/

#include <vector>

template<typename T> class Container : public T {
private:
  using S = typename T::value_type;

public:
  Container() : T() {}

  Container(int n) : T(n) {}

  Container(int n, S s) : T(n, s) {}

  template<typename Itr> Container(Itr first, Itr last) : T(first, last) {}

  Container(const std::initializer_list<S>& v) : T(v) {}

  Container(int n, Input& in) {
    std::vector<S> v(n);
    for (auto& i : v) {
      i = in;
    }
    *this = Container<T>(v.begin(), v.end());
  }

  bool in(const S& a) const {
    return find(this->begin(), this->end(), a) != this->end();
  }
};

/***********/
/* map.hpp */
/***********/

#include <map>

template<typename T, typename S> class Map : public Container<std::map<T, S>> {
public:
  Map() : Container<std::map<T, S>>() {}
};

/************/
/* main.cpp */
/************/

int main() {
  int mx = 0;
  Map<int, int> m;
  for (int n; n = in, !in.eof;) {
    ++m[n];
    chmax(mx, m[n]);
  }
  for (auto i : m) {
    if (i.second == mx) {
      cout << i.first << endl;
    }
  }
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int intager[100]={0};
  int num;
  while(cin>>num)
    intager[num-1]++;
  int flag=0;
  for(int i=100;i>0;i--){
    for(int j=0;j<100;j++){
      if(intager[j]==i){
	cout<<j+1<<endl;
	flag=1;
      }
    }
    if(flag==1)
      break;
  }
  return 0;
}

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

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

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

int main(){
  int n,m;
  int a[10]={0};
  while(cin>>n) a[n-1]++;
  m = *max_element(a,a+10);
  for(int i=0;i<10;i++){
    if(m==a[i]) cout<<i+1<<endl;
  }
  return 0;
}

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

int main()
{
	int ary[100] ;
	int get ;
	int tmp = 0 ;

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

	while( cin >> get )
	{
		ary[get-1] ++ ;

		if( ary[get-1] > tmp )
		{
			tmp = ary[get-1] ;
		}
	}

	for( int i = 0 ; i < 100 ; i ++ )
	{
		if( ary[i] == tmp )
		{
			cout << (i+1) << endl ;
		}
	}
	return 0 ;
}

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

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

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


int main(int argc, char *argv[])
{
  int x;
  vector<int> freq;
  int X[100] ={0};
  while(cin >>x){
    freq.push_back(x);
}
    int maxf = 0;
  for(int i = 0;i < freq.size();i++){
    X[freq[i]]++;
      maxf = max(maxf,X[freq[i]]);
    }
  for(int j = 0;j < 100;j++){
    if(X[j] == maxf){
      cout << j << endl;
    }
  }
  
  return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
using namespace std;

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

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