func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long n, k;     cin >> n >> k;     string str;     cin >> str;     int overlap = -1;     int max = -1;     for (int i = 1; i < n; ++i) {       if (str[i] == str[0]) {         int j = 0;         for (j = 0; i + j < n; ++j) {           if (str[i + j] == str[j]) continue;           break;         }         if (i + j == n && j > max) {           overlap = i;           max = j;         }       }     }     string firstHalf =   ;     string secondHalf = str;     if (overlap != -1) {       firstHalf = str.substr(0, overlap);       secondHalf = str.substr(overlap);       long long secondLen = secondHalf.length();       firstHalf = str.substr(0, secondLen);       secondHalf = str.substr(secondLen);     }     for (int x = 0; x < k; ++x) {       if (x == 0)         cout << str;       else         cout << secondHalf;     }     cout << endl;     return 0;   }   