#include <stdio.h>
#include <stdlib.h>
int main(void) {
int max = -1000;
int res = 0;
int count[10] = {0};
char checkNumber[101];
scanf("%s", checkNumber);
for (int i = 0; checkNumber[i] != '\0'; i++) {
count[checkNumber[i] - 48]++;
}
for (int i = 0; i < 10; i++) {
if (max < count[i]) {
max = count[i];
res = i;
} else if (max == count[i]) {
res = i;
}
}
printf("%d\n", res);
return 0;
}