public static void main ( String [ ] args ) {
  Scanner sc = new Scanner ( System . in ) ;
  String s = sc . next ( ) ;
  int n = s . length ( ) ;
  int [ ] [ ] table = new int [ n / 26 + 1 ] [ 26 ] ;
  int [ ] [ ] table2 = new int [ n / 26 + 1 ] [ 26 ] ;
  for ( int i = 0 ;
  i < table . length ;
  i ++ ) Arrays . fill ( table [ i ] , - 1 ) ;
  int res = 0 ;
  int index = n - 1 ;
  int count = 0 ;
  for ( ;
  index >= 0 ;
  index -- ) {
    int c = ( int ) ( s . charAt ( index ) - 'a' ) ;
    table2 [ res ] [ c ] = index ;
    if ( table [ res ] [ c ] != - 1 ) continue ;
    table [ res ] [ c ] = index ;
    count ++ ;
    if ( count == 26 ) {
      res ++ ;
      count = 0 ;
    }
  }
  int [ ] str = new int [ res + 1 ] ;
  for ( int i = res ;
  i >= 0 ;
  i -- ) {
    int pre = 0 ;
    for ( int j = 0 ;
    j < 26 ;
    j ++ ) {
      if ( table [ i ] [ j ] != - 1 ) continue ;
      pre = j ;
      break ;
    }
    str [ res - i ] = pre ;
    if ( i > 0 ) {
      int min = table2 [ i - 1 ] [ pre ] ;
      for ( int j = 0 ;
      j < 26 ;
      j ++ ) {
        if ( table [ i - 1 ] [ j ] <= min ) table [ i - 1 ] [ j ] = - 1 ;
      }
    }
  }
  for ( int i = 0 ;
  i < res + 1 ;
  i ++ ) System . out . print ( ( char ) ( 'a' + str [ i ] ) ) ;
  System . out . println ( ) ;
}

public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int n = s . length ( ) ; int [ ] [ ] table = new int [ n / 26 + 1 ] [ 26 ] ; int [ ] [ ] table2 = new int [ n / 26 + 1 ] [ 26 ] ; for ( int i = 0 ; i < table . length ; i ++ ) Arrays . fill ( table [ i ] , - 1 ) ; int res = 0 ; int index = n - 1 ; int count = 0 ; for ( ; index >= 0 ; index -- ) { int c = ( int ) ( s . charAt ( index ) - ' a ' ) ; table2 [ res ] [ c ] = index ; if ( table [ res ] [ c ] != - 1 ) continue ; table [ res ] [ c ] = index ; count ++ ; if ( count == 26 ) { res ++ ; count = 0 ; } } int [ ] str = new int [ res + 1 ] ; for ( int i = res ; i >= 0 ; i -- ) { int pre = 0 ; for ( int j = 0 ; j < 26 ; j ++ ) { if ( table [ i ] [ j ] != - 1 ) continue ; pre = j ; break ; } str [ res - i ] = pre ; if ( i > 0 ) { int min = table2 [ i - 1 ] [ pre ] ; for ( int j = 0 ; j < 26 ; j ++ ) { if ( table [ i - 1 ] [ j ] <= min ) table [ i - 1 ] [ j ] = - 1 ; } } } for ( int i = 0 ; i < res + 1 ; i ++ ) System . out . print ( ( char ) ( ' a ' + str [ i ] ) ) ; System . out . println ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) dimensions: (dimensions_expr (decimal_integer_literal))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) dimensions: (dimensions_expr (decimal_integer_literal))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (unary_expression operand: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal)))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (identifier))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (identifier))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (break_statement))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (identifier)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal))))))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (character_literal) right: (array_access array: (identifier) index: (identifier))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list)))))