static int solve ( ) {
  int [ ] str = in . next ( ) . chars ( ) . map ( ( i ) -> i == '+' ? 0 : 1 ) . toArray ( ) ;
  int size = in . nextInt ( ) ;
  int count = 0 ;
  for ( int i = 0 ;
  i < str . length - size + 1 ;
  ++ i ) {
    if ( str [ i ] != 0 ) {
      count ++ ;
      for ( int j = i ;
      j < i + size ;
      ++ j ) {
        str [ j ] = str [ j ] == 1 ? 0 : 1 ;
      }
    }
  }
  for ( int i = str . length - size + 1 ;
  i < str . length ;
  ++ i ) {
    if ( str [ i ] != 0 ) return - 1 ;
  }
  return count ;
}

static int solve ( ) { int [ ] str = in . next ( ) . chars ( ) . map ( ( i ) -> i == ' + ' ? 0 : 1 ) . toArray ( ) ; int size = in . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < str . length - size + 1 ; ++ i ) { if ( str [ i ] != 0 ) { count ++ ; for ( int j = i ; j < i + size ; ++ j ) { str [ j ] = str [ j ] == 1 ? 0 : 1 ; } } } for ( int i = str . length - size + 1 ; i < str . length ; ++ i ) { if ( str [ i ] != 0 ) return - 1 ; } return count ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters) body: (block (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (lambda_expression parameters: (inferred_parameters (identifier)) body: (ternary_expression condition: (binary_expression left: (identifier) right: (character_literal)) consequence: (decimal_integer_literal) alternative: (decimal_integer_literal))))) 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: (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: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (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: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (ternary_expression condition: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (decimal_integer_literal)))))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (identifier)) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (return_statement (unary_expression operand: (decimal_integer_literal)))))) (return_statement (identifier))))