static boolean checkPattern ( String str , String pattern ) {
  int len = pattern . length ( ) ;
  if ( str . length ( ) < len ) {
    return false ;
  }
  for ( int i = 0 ;
  i < len - 1 ;
  i ++ ) {
    char x = pattern . charAt ( i ) ;
    char y = pattern . charAt ( i + 1 ) ;
    int last = str . lastIndexOf ( x ) ;
    int first = str . indexOf ( y ) ;
    if ( last == - 1 || first == - 1 || last > first ) {
      return false ;
    }
  }
  return true ;
}

static boolean checkPattern ( String str , String pattern ) { int len = pattern . length ( ) ; if ( str . length ( ) < len ) { return false ; } for ( int i = 0 ; i < len - 1 ; i ++ ) { char x = pattern . charAt ( i ) ; char y = pattern . charAt ( i + 1 ) ; int last = str . lastIndexOf ( x ) ; int first = str . indexOf ( y ) ; if ( last == - 1 || first == - 1 || last > first ) { return false ; } } return true ; }
(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))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (identifier))) consequence: (block (return_statement (false)))) (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 (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 object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (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 object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal))) right: (binary_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal)))) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (block (return_statement (false)))))) (return_statement (true))))