func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> pf(const string& s) {     int n = s.size();     vector<int> pi(n);     for (int i = 1; i < n; i++) {       int j = pi[i - 1];       while (j > 0 && s[i] != s[j]) j = pi[j - 1];       if (s[i] == s[j]) j++;       pi[i] = j;     }     return pi;   }   int main() {     ios_base::sync_with_stdio(false);     string s;     string t;     cin >> s >> t;     auto a = pf(t);     int val = t.length() - a.back();     int cyc = val;     int c1 = 0, c0 = 0;     for (int i = 0; i < s.length(); i++) {       if (s[i] ==  1 )         c1++;       else         c0++;     }     int p = 0;     while (true) {       if (t[p] ==  0 ) {         if (c0) {           cout << 0;           c0--;         } else           break;       } else {         if (c1) {           cout << 1;           c1--;         } else           break;       }       p++;       p %= cyc;     }     while (c1) {       cout << 1;       c1--;     }     while (c0) {       cout << 0;       c0--;     }     return 0;   }   