public static void main ( String [ ] args ) {
  Scanner scn = new Scanner ( System . in ) ;
  String s = "ROYGBV" ;
  String str = scn . next ( ) . trim ( ) ;
  char ch [ ] = str . toCharArray ( ) ;
  int [ ] freq = new int [ 6 ] ;
  for ( char c : ch ) freq [ s . indexOf ( c ) ] ++ ;
  Arrays . sort ( freq ) ;
  String f = "" ;
  for ( int x : freq ) {
    f = f + x ;
  }
  int result = 0 ;
  if ( f . equals ( "000006" ) ) {
    result = 1 ;
  }
  else if ( f . equals ( "000015" ) ) {
    result = 1 ;
  }
  else if ( f . equals ( "000024" ) ) {
    result = 2 ;
  }
  else if ( f . equals ( "000123" ) ) {
    result = 3 ;
  }
  else if ( f . equals ( "000222" ) ) {
    result = 6 ;
  }
  else if ( f . equals ( "001113" ) ) {
    result = 5 ;
  }
  else if ( f . equals ( "001122" ) ) {
    result = 8 ;
  }
  else if ( f . equals ( "000033" ) ) {
    result = 2 ;
  }
  else if ( f . equals ( "011112" ) ) {
    result = 15 ;
  }
  else if ( f . equals ( "111111" ) ) {
    result = 30 ;
  }
  else if ( f . equals ( "000114" ) ) {
    result = 2 ;
  }
  System . out . println ( result ) ;
}

public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; String s = " ROYGBV " ; String str = scn . next ( ) . trim ( ) ; char ch [ ] = str . toCharArray ( ) ; int [ ] freq = new int [ 6 ] ; for ( char c : ch ) freq [ s . indexOf ( c ) ] ++ ; Arrays . sort ( freq ) ; String f = " " ; for ( int x : freq ) { f = f + x ; } int result = 0 ; if ( f . equals ( "000006" ) ) { result = 1 ; } else if ( f . equals ( "000015" ) ) { result = 1 ; } else if ( f . equals ( "000024" ) ) { result = 2 ; } else if ( f . equals ( "000123" ) ) { result = 3 ; } else if ( f . equals ( "000222" ) ) { result = 6 ; } else if ( f . equals ( "001113" ) ) { result = 5 ; } else if ( f . equals ( "001122" ) ) { result = 8 ; } else if ( f . equals ( "000033" ) ) { result = 2 ; } else if ( f . equals ( "011112" ) ) { result = 15 ; } else if ( f . equals ( "111111" ) ) { result = 30 ; } else if ( f . equals ( "000114" ) ) { result = 2 ; } System . out . println ( result ) ; }
(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: (string_literal))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration 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))))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (expression_statement (update_expression (array_access array: (identifier) index: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))))))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))