public static void main ( String [ ] args ) {
  Scanner scan = new Scanner ( System . in ) ;
  String s = scan . next ( ) + 'T' ;
  int x = scan . nextInt ( ) ;
  int y = scan . nextInt ( ) ;
  List < Integer > hol = new ArrayList < > ( ) ;
  List < Integer > ver = new ArrayList < > ( ) ;
  int index = 0 ;
  while ( s . charAt ( index ) != 'T' ) ++ index ;
  x -= index ;
  int cnt = 0 ;
  int vec = 0 ;
  for ( int i = index ;
  i < s . length ( ) ;
  ++ i ) {
    if ( s . charAt ( i ) == 'F' ) ++ cnt ;
    else {
      ++ vec ;
      if ( cnt > 0 ) {
        if ( vec % 2 == 1 ) hol . add ( cnt ) ;
        else ver . add ( cnt ) ;
        cnt = 0 ;
      }
    }
  }
  if ( canSet ( x , hol ) && canSet ( y , ver ) ) {
    System . out . println ( "Yes" ) ;
  }
  else {
    System . out . println ( "No" ) ;
  }
}

public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) + ' T ' ; int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; List < Integer > hol = new ArrayList < > ( ) ; List < Integer > ver = new ArrayList < > ( ) ; int index = 0 ; while ( s . charAt ( index ) != ' T ' ) ++ index ; x -= index ; int cnt = 0 ; int vec = 0 ; for ( int i = index ; i < s . length ( ) ; ++ i ) { if ( s . charAt ( i ) == ' F ' ) ++ cnt ; else { ++ vec ; if ( cnt > 0 ) { if ( vec % 2 == 1 ) hol . add ( cnt ) ; else ver . add ( cnt ) ; cnt = 0 ; } } } if ( canSet ( x , hol ) && canSet ( y , ver ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (character_literal)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) body: (expression_statement (update_expression (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (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: (identifier))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (expression_statement (update_expression (identifier))) alternative: (block (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) alternative: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))))