public static void main ( String [ ] args ) {
  InputStream in = System . in ;
  final byte [ ] bytes = new byte [ 200001 ] ;
  int length = 0 ;
  try {
    length = in . read ( bytes ) ;
  }
  catch ( IOException e ) {
  }
  int count = 0 ;
  long sum = 0 ;
  for ( int i = 0 ;
  i < length ;
  i ++ ) {
    if ( bytes [ i ] == 'B' ) count ++ ;
    else if ( bytes [ i ] == 'W' ) sum += count ;
  }
  System . out . println ( sum ) ;
}

public static void main ( String [ ] args ) { InputStream in = System . in ; final byte [ ] bytes = new byte [ 200001 ] ; int length = 0 ; try { length = in . read ( bytes ) ; } catch ( IOException e ) { } int count = 0 ; long sum = 0 ; for ( int i = 0 ; i < length ; i ++ ) { if ( bytes [ i ] == ' B ' ) count ++ ; else if ( bytes [ i ] == ' W ' ) sum += count ; } System . out . println ( sum ) ; }
(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: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (try_statement body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (catch_clause (catch_formal_parameter (catch_type (type_identifier)) name: (identifier)) body: (block))) (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: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (expression_statement (update_expression (identifier))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))