int main(void) {
    char s[1000] = "";

    while(gets(s)) {
        int result[131] = {0};
        char s1[1000] = "";
        int maxIndex = 0;
        int max = 0;
        int i = 0;
        int count = 0;
        int j =0 ;
        for(i = 0; i < strlen(s); i++) {
            result[s[i]]++;
        }
        for(i = 0; i < 131; i++) {
            if(result[i] > 0) 
                count++;
        }
        while(j < count) {
            max = 0;
            maxIndex = 0;
            for(i = 0; i < 131; i++) {
                if(max < result[i]) {
                    max = result[i];
                    maxIndex = i;
                }
            }
            result[maxIndex] = 0;
            s1[j] = (char)maxIndex;
            j++;
        }
        printf("%s\n", s1);
    }
}