static boolean strmatch ( String str , String pattern , int n , int m ) {
  if ( m == 0 ) return ( n == 0 ) ;
  boolean [ ] [ ] lookup = new boolean [ n + 1 ] [ m + 1 ] ;
  for ( int i = 0 ;
  i < n + 1 ;
  i ++ ) Arrays . fill ( lookup [ i ] , false ) ;
  lookup [ 0 ] [ 0 ] = true ;
  for ( int j = 1 ;
  j <= m ;
  j ++ ) if ( pattern . charAt ( j - 1 ) == '*' ) lookup [ 0 ] [ j ] = lookup [ 0 ] [ j - 1 ] ;
  for ( int i = 1 ;
  i <= n ;
  i ++ ) {
    for ( int j = 1 ;
    j <= m ;
    j ++ ) {
      if ( pattern . charAt ( j - 1 ) == '*' ) lookup [ i ] [ j ] = lookup [ i ] [ j - 1 ] || lookup [ i - 1 ] [ j ] ;
      else if ( pattern . charAt ( j - 1 ) == '?' || str . charAt ( i - 1 ) == pattern . charAt ( j - 1 ) ) lookup [ i ] [ j ] = lookup [ i - 1 ] [ j - 1 ] ;
      else lookup [ i ] [ j ] = false ;
    }
  }
  return lookup [ n ] [ m ] ;
}

static boolean strmatch ( String str , String pattern , int n , int m ) { if ( m == 0 ) return ( n == 0 ) ; boolean [ ] [ ] lookup = new boolean [ n + 1 ] [ m + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) Arrays . fill ( lookup [ i ] , false ) ; lookup [ 0 ] [ 0 ] = true ; for ( int j = 1 ; j <= m ; j ++ ) if ( pattern . charAt ( j - 1 ) == ' * ' ) lookup [ 0 ] [ j ] = lookup [ 0 ] [ j - 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= m ; j ++ ) { if ( pattern . charAt ( j - 1 ) == ' * ' ) lookup [ i ] [ j ] = lookup [ i ] [ j - 1 ] || lookup [ i - 1 ] [ j ] ; else if ( pattern . charAt ( j - 1 ) == ' ? ' || str . charAt ( i - 1 ) == pattern . charAt ( j - 1 ) ) lookup [ i ] [ j ] = lookup [ i - 1 ] [ j - 1 ] ; else lookup [ i ] [ j ] = false ; } } return lookup [ n ] [ m ] ; }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))) (local_variable_declaration type: (array_type element: (boolean_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal))) 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: (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: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (false))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (decimal_integer_literal)) right: (true))) (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: (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal))) consequence: (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (binary_expression left: (identifier) right: (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: (identifier)) update: (update_expression (identifier)) body: (block (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 (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal))) consequence: (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (identifier))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal)) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))))) consequence: (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) alternative: (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (false))))))))) (return_statement (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))))