func_code_string: #include <bits/stdc++.h>   using namespace std;   const int OO = 0x3f3f3f3f, N = 1e3 + 5, mod = 1e9 + 7;   string str;   vector<int> p, v;   vector<pair<int, vector<int>>> pos;   pair<int, char> occ[26];   int c[N], x = 1, n;   char ans[N];   int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }   int LCM(int a, int b) { return a / GCD(a, b) * b; }   void primes() {     for (int i = 2; i <= str.size(); ++i) {       bool flag = 1;       for (int j = 2; j * j <= i; ++j)         if (i % j == 0) flag = 0;       if (flag) p.push_back(i);     }   }   void sames() {     map<int, vector<int>> mp;     bool f[N] = {};     for (int i = 0; i < p.size(); ++i) {       if (f[c[i]]) continue;       f[c[i]] = 1;       for (int j = 0; j < p.size(); ++j)         if (c[i] == c[j]) mp[c[i]].push_back(p[j]);     }     for (auto& ptr : mp) {       bool flag[N] = {};       pair<int, vector<int>> tmp = {0, ptr.second};       for (int ch : ptr.second)         for (int i = ch; i <= n; i += ch) flag[i] = 1;       for (int i = 0; i < N; ++i) tmp.first += flag[i];       pos.push_back(tmp);     }     sort(pos.rbegin(), pos.rend());   }   void occur() {     for (int i = 0; i < 26; ++i) occ[i].second = (char)(i +  a );     for (char ch : str) ++occ[ch -  a ].first;   }   int main() {     memset(c, -1, sizeof c);     cin >> str;     n = str.size();     primes();     for (int i = 0; i < p.size(); ++i) {       if (c[i] == -1) c[i] = x;       for (int j = 0; j < p.size(); ++j)         if (LCM(p[i], p[j]) <= str.size()) c[j] = c[i];       ++x;     }     sames();     occur();     for (auto go : pos) {       bool flag = 1;       sort(occ, occ + 26);       for (int i = 0; i < 26; ++i)         if (occ[i].first >= go.first) {           flag = 0;           char chr = occ[i].second;           occ[i].first -= go.first;           for (int ch : go.second)             for (int i = ch; i <= n; i += ch) ans[i] = chr;           break;         }       if (flag) exit(puts( NO ));     }     puts( YES );     for (int i = 1; i <= n; ++i) {       if (ans[i] >=  a  && ans[i] <=  z )         cout << ans[i];       else {         for (int j = 0; j < 26; ++j)           if (occ[j].first) {             --occ[j].first;             cout << occ[j].second;             break;           }       }     }     return 0;   }   