C++ 代码
#include<bits/stdc++.h>
using namespace std;
int a[10],n,res;
int main(){
string s;
while(cin>>s){
n = -999;
for(int i=0;i<s.length();i++){
a[s[i]-'0']++;
}
for(int i=0;i<10;i++){
// cout<<a[i]<<' ';
if(a[i]>n){
n=a[i];
res = i;
}
}
memset(a,0,sizeof a);
cout<<res<<endl;
}
return 0;
}