public static void main ( String [ ] args ) {
  String s = input . next ( ) ;
  long len = s . length ( ) ;
  long res = Long . parseLong ( s ) ;
  long sum = getSum ( res ) ;
  for ( int i = 0 ;
  i < len - 1 ;
  i ++ ) {
    if ( s . charAt ( i ) == '0' ) continue ;
    long number = Long . parseLong ( s ) ;
    number = number - ( Long . parseLong ( s . substring ( i + 1 ) ) + 1 ) ;
    if ( getSum ( number ) == sum && number > res || ( getSum ( number ) > sum ) ) {
      res = number ;
      sum = getSum ( number ) ;
    }
  }
  System . out . println ( res ) ;
}

public static void main ( String [ ] args ) { String s = input . next ( ) ; long len = s . length ( ) ; long res = Long . parseLong ( s ) ; long sum = getSum ( res ) ; for ( int i = 0 ; i < len - 1 ; i ++ ) { if ( s . charAt ( i ) == '0' ) continue ; long number = Long . parseLong ( s ) ; number = number - ( Long . parseLong ( s . substring ( i + 1 ) ) + 1 ) ; if ( getSum ( number ) == sum && number > res || ( getSum ( number ) > sum ) ) { res = number ; sum = getSum ( number ) ; } } System . out . println ( res ) ; }
(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: (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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (continue_statement)) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))) right: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier))) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier))) right: (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))