import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        while(in.hasNext()){
            // solution1(in);
            solution2(in);
        }
    }

    /**
     * 模拟法: 贪心
     * 从后往前遍历(双指针)
     * @param in
     */
    private static void solution1(Scanner in){
        char[] chars = in.nextLine().toCharArray();

        int len = chars.length;
        StringBuilder sb = new StringBuilder();
        for(int i=len-1,j=i; i>=0;){
            if(chars[i] >= chars[j]){
                sb.insert(0, chars[i]);
                j = i;
            }
            i--;
        }

        System.out.println(sb);
    }

    /**
     * 模拟法: 贪心
     * 从后往前遍历
     * @param in
     */
    private static void solution2(Scanner in){
        String s = in.nextLine();

        int len = s.length();
        char curr;
        char max = s.charAt(len-1);
        StringBuilder sb = new StringBuilder();
        for(int i=len-1; i>=0; i--){
            curr = s.charAt(i);
            if(curr > max){
                sb.insert(0, curr);
                max = curr;
            }else if(curr == max){
                sb.insert(0, curr);
            }
        }

        System.out.println(sb);
    }
}