static char [ ] replaceSpaces ( char [ ] str ) {
  int space_count = 0 , i = 0 ;
  for ( i = 0 ;
  i < str . length ;
  i ++ ) if ( str [ i ] == ' ' ) space_count ++ ;
  while ( str [ i - 1 ] == ' ' ) {
    space_count -- ;
    i -- ;
  }
  int new_length = i + space_count * 2 ;
  if ( new_length > MAX ) return str ;
  int index = new_length - 1 ;
  char [ ] new_str = str ;
  str = new char [ new_length ] ;
  for ( int j = i - 1 ;
  j >= 0 ;
  j -- ) {
    if ( new_str [ j ] == ' ' ) {
      str [ index ] = '0' ;
      str [ index - 1 ] = '2' ;
      str [ index - 2 ] = '%' ;
      index = index - 3 ;
    }
    else {
      str [ index ] = new_str [ j ] ;
      index -- ;
    }
  }
  return str ;
}

static char [ ] replaceSpaces ( char [ ] str ) { int space_count = 0 , i = 0 ; for ( i = 0 ; i < str . length ; i ++ ) if ( str [ i ] == ' ▁ ' ) space_count ++ ; while ( str [ i - 1 ] == ' ▁ ' ) { space_count -- ; i -- ; } int new_length = i + space_count * 2 ; if ( new_length > MAX ) return str ; int index = new_length - 1 ; char [ ] new_str = str ; str = new char [ new_length ] ; for ( int j = i - 1 ; j >= 0 ; j -- ) { if ( new_str [ j ] == ' ▁ ' ) { str [ index ] = '0' ; str [ index - 1 ] = '2' ; str [ index - 2 ] = ' % ' ; index = index - 3 ; } else { str [ index ] = new_str [ j ] ; index -- ; } } return str ; }
(method_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (expression_statement (update_expression (identifier))))) (while_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) body: (block (expression_statement (update_expression (identifier))) (expression_statement (update_expression (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (return_statement (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (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: (identifier) index: (identifier)) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))) alternative: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (update_expression (identifier))))))) (return_statement (identifier))))