#include <stdio.h>
#include <string.h>
// a-z
// a-a+10
// 0-9
// 10-35
// 只会出现整数次
//统计最大值后降序输出 max-1
int main()
{
char str[1001] = {'\0'};
while (scanf("%s", str) != EOF)
{
int count[36] = {0};
int len = strlen(str);
for (int i = 0; i < len; i++)
{
if (str[i] >= 'a' && str[i] <= 'z')
{
count[str[i] - 'a' + 10]++;
}
else
{
count[str[i] - '0']++;
}
}
int max = 0;
for (int i = 0; i < 36; i++)
{
if (count[i] > max)
max = count[i];
}
for (int i = max; i >= 1; i--)
{
for (int j = 0; j < 36; j++)
{
if (count[j] == i)
{
if (j >= 0 && j <= 9)
printf("%c", j + '0');
else
printf("%c", j - 10 + 'a');
}
}
}
printf("\n");
}
return 0;
}