static int maxPartition ( String s ) {
  int n = s . length ( ) , P = 0 ;
  String current = "" , previous = "" ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    current += s . charAt ( i ) ;
    if ( ! current . equals ( previous ) ) {
      previous = current ;
      current = "" ;
      P ++ ;
    }
  }
  return P ;
}

static int maxPartition ( String s ) { int n = s . length ( ) , P = 0 ; String current = " " , previous = " " ; for ( int i = 0 ; i < n ; i ++ ) { current += s . charAt ( i ) ; if ( ! current . equals ( previous ) ) { previous = current ; current = " " ; P ++ ; } } return P ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal)) declarator: (variable_declarator name: (identifier) value: (string_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: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (string_literal))) (expression_statement (update_expression (identifier))))))) (return_statement (identifier))))