#include <stdio.h>
#include <string.h>

int main() {
    char str[1000] = {0};
    char str_zm[1000] = {0};
    char str_same[1000]={0};
    char str_record = {0};
    int  str_record_i;
    int str_same_i[1000]={0};
    char temp;
    char temp_zm;
    int k;
    scanf("%[^\n]\n", str);
    for (int i = 0; i < strlen(str); i++) {
        if (((str[i] >= 65) && (str[i] <= 90)) || ((str[i] >= 97) && (str[i] <= 122))) {
            if ((str[i] >= 97) && (str[i] <= 122))
                str_zm[i] = str[i] - 32;
            if ((str[i] >= 65) && (str[i] <= 90))
                str_zm[i] = str[i];
        }
    }
    \
    \
    for (int i = 0; i < strlen(str)-1; i++) {

        if ((str_zm[i] >= 65) && (str_zm[i] <= 90)){
        str_record = str_zm[i];
        str_record_i = i;
        k=i;
            for (int j = i + 1; j < strlen(str); j++) {
                if ((str_zm[j] < str_record) && (str_zm[j] != '\0')) {
                    str_record_i = j;
                    str_record = str_zm[j];
                }
            if ((str_zm[j] == str_zm[i])) {
                k++;
                }
            }
            if (k > (i )) {
                temp = str[str_record_i];
                temp_zm = str_zm[str_record_i];
                for (int jj = str_record_i; jj >= i; jj--) {
                    int step = 0;
                    while (!(((str[jj - 1] >= 65) && (str[jj - 1] <= 90)) || ((str[jj - 1] >= 97) &&
                             (str[jj - 1] <= 122)))) {
                        step++;
                        jj--;
                    }
                    str[jj + step] = str[jj - 1];
                    str_zm[jj + step] = str_zm[jj - 1];

                }
                str[i] = temp;
                str_zm[i] = temp_zm;
            }
            if (k == (i )) {
                // printf("%d\n",j);
                // printf("%d\n",i);
                temp = str[i];
                temp_zm = str_zm[i];
                str[i] = str[str_record_i];
                str_zm[i] = str_zm[str_record_i];
                str[str_record_i] = temp;
                str_zm[str_record_i] = temp_zm;
            }
        }
    }
for (int i = 0; i < strlen(str); i++)
    printf("%c", str[i]);
// printf("%d\n",k);
// printf("%d\n",strlen(str));
return 0;
}