public static void solve ( InputReader in ) {
  int n = in . readInt ( ) ;
  int k = in . readInt ( ) ;
  char s [ ] = in . readString ( ) . toCharArray ( ) ;
  int lps [ ] = new int [ n ] ;
  for ( int i = 1 ;
  i < n ;
  i ++ ) {
    int j = lps [ i - 1 ] ;
    while ( j > 0 && s [ i ] != s [ j ] ) {
      j = lps [ j - 1 ] ;
    }
    if ( s [ i ] == s [ j ] ) {
      lps [ i ] = ++ j ;
    }
  }
  int sub = n - lps [ n - 1 ] ;
  for ( int i = 0 ;
  i < k - 1 ;
  i ++ ) {
    for ( int j = 0 ;
    j < sub ;
    j ++ ) {
      System . out . print ( s [ j ] ) ;
    }
  }
  System . out . print ( new String ( s ) ) ;
}

public static void solve ( InputReader in ) { int n = in . readInt ( ) ; int k = in . readInt ( ) ; char s [ ] = in . readString ( ) . toCharArray ( ) ; int lps [ ] = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { int j = lps [ i - 1 ] ; while ( j > 0 && s [ i ] != s [ j ] ) { j = lps [ j - 1 ] ; } if ( s [ i ] == s [ j ] ) { lps [ i ] = ++ j ; } } int sub = n - lps [ n - 1 ] ; for ( int i = 0 ; i < k - 1 ; i ++ ) { for ( int j = 0 ; j < sub ; j ++ ) { System . out . print ( s [ j ] ) ; } } System . out . print ( new String ( s ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (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)))) (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) dimensions: (dimensions) 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: (array_creation_expression type: (integral_type) 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: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))) body: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (update_expression (identifier)))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (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 (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))))))