func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1005;   int vis[maxn], p[maxn];   int plen;   void prime() {     memset(vis, 0, sizeof(vis));     plen = 0;     for (int i = 2, k = 4; i < maxn; ++i, k += i + i - 1) {       if (!vis[i]) {         p[plen++] = i;         if (k < maxn) {           for (int j = k; j < maxn; j += i) {             vis[j] = 1;           }         }       }     }   }   struct node {     int id;     int cnt;     int color;   } need[maxn];   bool cmp(const node &a, const node &b) { return a.cnt > b.cnt; }   bool cmp1(const node &a, const node &b) { return a.id < b.id; }   char buf[maxn], out[maxn];   int cnt[maxn];   int main(int argc, char *argv[]) {     prime();     while (scanf( %s , buf) != EOF) {       memset(vis, -1, sizeof(vis));       memset(cnt, 0, sizeof(cnt));       int len = strlen(buf);       for (int i = 0; i < len; i++) {         cnt[buf[i] -  a ]++;       }       int colornum = 0;       for (int i = 0; i < plen && p[i] <= len; i++) {         int color = -1;         for (int j = 1; j <= len / p[i]; j++) {           if (vis[j * p[i]] != -1) {             color = vis[j];             break;           }         }         if (color == -1) {           color = colornum++;         }         for (int j = 1; j <= len / p[i]; j++) {           vis[j * p[i]] = color;         }       }       for (int i = 0; i < maxn; i++) {         need[i].id = i;         need[i].cnt = 0;       }       for (int i = 2; i <= len; i++) {         need[vis[i]].cnt++;       }       sort(need, need + colornum, cmp);       int flag = 0;       for (int i = 0; i < colornum; i++) {         int maxcolor = 0, k = -1;         for (int j = 0; j < 26; j++) {           if (cnt[j] > maxcolor) {             maxcolor = cnt[j];             k = j;           }         }         if (k == -1 || maxcolor < need[i].cnt) {           flag = 1;           break;         } else {           need[i].color = k;           cnt[k] -= need[i].cnt;         }       }       if (!flag) {         printf( YES n );         for (int i = 0; i < 26; i++) {           if (cnt[i]) {             out[1] = i +  a ;             break;           }         }         sort(need, need + colornum, cmp1);         for (int i = 2; i <= len; i++) {           out[i] = need[vis[i]].color +  a ;         }         out[len + 1] = 0;         printf( %s n , out + 1);       } else {         printf( NO n );       }     }     return 0;   }   