public static void main ( String [ ] args ) {
  try {
    Scanner scan = new Scanner ( new File ( String . format ( "%s-%s.in" , PROBLEM , ( SMALL ? "small" : "large" ) ) ) ) ;
    PrintWriter pw = new PrintWriter ( new File ( String . format ( "%s-%s.out" , PROBLEM , ( SMALL ? "small" : "large" ) ) ) ) ;
    int L = scan . nextInt ( ) , D = scan . nextInt ( ) , N = scan . nextInt ( ) ;
    scan . nextLine ( ) ;
    String [ ] dictionary = new String [ D ] ;
    for ( int i = 0 ;
    i < D ;
    ++ i ) dictionary [ i ] = scan . nextLine ( ) ;
    System . out . println ( String . format ( "%d test cases:" , N ) ) ;
    long start = System . currentTimeMillis ( ) , t1 , left ;
    for ( int CASE = 1 ;
    CASE <= N ;
    ++ CASE ) {
      t1 = System . currentTimeMillis ( ) ;
      System . out . print ( String . format ( "%d.[%s] " , CASE , new SimpleDateFormat ( "HH:mm:ss.SSS" ) . format ( new Date ( t1 ) ) ) ) ;
      String pattern = scan . nextLine ( ) ;
      pattern = pattern . replace ( '(' , '[' ) . replace ( ')' , ']' ) ;
      Pattern p = Pattern . compile ( pattern ) ;
      int cnt = 0 ;
      for ( int i = 0 ;
      i < D ;
      ++ i ) if ( p . matcher ( dictionary [ i ] ) . matches ( ) ) cnt ++ ;
      String res = String . valueOf ( cnt ) ;
      pw . println ( String . format ( "Case #%d: %s" , CASE , res ) ) ;
      left = ( System . currentTimeMillis ( ) - start ) * ( N - CASE ) / CASE ;
      System . out . println ( String . format ( "%s (%dms, ~%dms left)" , res , ( System . currentTimeMillis ( ) - t1 ) , left ) ) ;
    }
    pw . close ( ) ;
    scan . close ( ) ;
  }
  catch ( Exception e ) {
    e . printStackTrace ( ) ;
  }
}

public static void main ( String [ ] args ) { try { Scanner scan = new Scanner ( new File ( String . format ( " % s - % s . in " , PROBLEM , ( SMALL ? " small " : " large " ) ) ) ) ; PrintWriter pw = new PrintWriter ( new File ( String . format ( " % s - % s . out " , PROBLEM , ( SMALL ? " small " : " large " ) ) ) ) ; int L = scan . nextInt ( ) , D = scan . nextInt ( ) , N = scan . nextInt ( ) ; scan . nextLine ( ) ; String [ ] dictionary = new String [ D ] ; for ( int i = 0 ; i < D ; ++ i ) dictionary [ i ] = scan . nextLine ( ) ; System . out . println ( String . format ( " % d ▁ test ▁ cases : " , N ) ) ; long start = System . currentTimeMillis ( ) , t1 , left ; for ( int CASE = 1 ; CASE <= N ; ++ CASE ) { t1 = System . currentTimeMillis ( ) ; System . out . print ( String . format ( " % d . [ % s ] ▁ " , CASE , new SimpleDateFormat ( " HH : mm : ss . SSS " ) . format ( new Date ( t1 ) ) ) ) ; String pattern = scan . nextLine ( ) ; pattern = pattern . replace ( ' ( ' , ' [ ' ) . replace ( ' ) ' , ' ] ' ) ; Pattern p = Pattern . compile ( pattern ) ; int cnt = 0 ; for ( int i = 0 ; i < D ; ++ i ) if ( p . matcher ( dictionary [ i ] ) . matches ( ) ) cnt ++ ; String res = String . valueOf ( cnt ) ; pw . println ( String . format ( " Case ▁ # % d : ▁ % s " , CASE , res ) ) ; left = ( System . currentTimeMillis ( ) - start ) * ( N - CASE ) / CASE ; System . out . println ( String . format ( " % s ▁ ( % dms , ▁ ~ % dms ▁ left ) " , res , ( System . currentTimeMillis ( ) - t1 ) , left ) ) ; } pw . close ( ) ; scan . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }
(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 (try_statement body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier) (parenthesized_expression (ternary_expression condition: (identifier) consequence: (string_literal) alternative: (string_literal))))))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier) (parenthesized_expression (ternary_expression condition: (identifier) consequence: (string_literal) alternative: (string_literal))))))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (type_identifier) dimensions: (dimensions_expr (identifier))))) (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: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (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 (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier) (method_invocation object: (object_creation_expression type: (type_identifier) arguments: (argument_list (string_literal))) name: (identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier)))))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (character_literal) (character_literal))) name: (identifier) arguments: (argument_list (character_literal) (character_literal))))) (local_variable_declaration type: (type_identifier) 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: (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: (if_statement condition: (parenthesized_expression (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))) name: (identifier) arguments: (argument_list))) consequence: (expression_statement (update_expression (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier) (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (identifier))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) right: (identifier)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier) (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (identifier))) (identifier)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (catch_clause (catch_formal_parameter (catch_type (type_identifier)) name: (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))))