#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const int N = 10;
int t,n,m,k,l,r,op,x,y;
int f[N];
string str;
void solve(){
while(cin>>str){
memset(f,0,sizeof(f));
for(char&ch:str)f[ch-'0']++;
cout<<(max_element(f,f+N)-f)<<"\n";
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}