#include<stdio.h>

int main(){

int hash[128]={0};
char data[1000]={0};
while(scanf("%s", data) != EOF){
    int lenth;
    for(lenth=0; data[lenth] != '\0'; lenth++){
        hash[data[lenth]]++;
    }
    int mmax = 0;
    int loc = 0;
    lenth =0;
    for(int x=48; x<128; x++){
        if(hash[x] != 0)lenth++;
    }
    for(int i=0; i<lenth; i++){
        for(int x=48; x<128; x++){
            if(hash[x]>mmax){
                loc = x;
                mmax = hash[x];
            }
        }
        printf("%c", loc);
        hash[loc] = 0;
        mmax = 0;
    }
    printf("\n");
}

}