func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 100005;   int n, cnt, sum, len, tlen, tcnt;   int a[26], ans[N], tans[N], id[26], pos[N], tpos[N];   void work1() {     printf( 0 n );     for (int i = 0; i < n; i++)       for (int j = 1; j <= a[i]; j++) printf( %c ,  a  + i);   }   bool cmp(int x, int y) { return a[x] > a[y]; }   int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }   int t, d;   void work(int x, int y) {     int j = 0;     tcnt = tlen = 0;     for (int i = x; i <= cnt; i += x) {       while (j + 1 <= pos[i]) {         j++;         tans[++tlen] = ans[j];       }       if (i % (2 * x) == 0) {         for (int l = 1; l <= y; l++) tans[++tlen] = t;         tpos[++tcnt] = tlen;         for (int l = 1; l <= y; l++) tans[++tlen] = t;       } else         tpos[++tcnt] = tlen;     }     while (j < len) tans[++tlen] = ans[++j];     cnt = tcnt;     for (int i = 1; i <= cnt; i++) pos[i] = tpos[i];     len = tlen;     for (int i = 1; i <= len; i++) ans[i] = tans[i];   }   void work2(int x, int y) {     int j = 0;     tlen = 0;     for (int i = x; i <= cnt; i += x) {       while (j + 1 <= pos[i]) {         j++;         tans[++tlen] = ans[j];       }       for (int l = 1; l <= y; l++) tans[++tlen] = t;     }     while (j < len) tans[++tlen] = ans[++j];     len = tlen;     for (int i = 1; i <= len; i++) ans[i] = tans[i];   }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++)       scanf( %d , &a[i]), cnt += a[i] & 1, sum += a[i], id[i] = i;     if (cnt > 1) {       work1();       return 0;     }     sort(id, id + n);     cnt = 0;     for (int i = 0; i < n; i++) {       t = id[i];       if (a[t] & 1) continue;       if (len == 0) {         len = a[t];         cnt = len;         for (int i = 1; i <= len; i++) ans[i] = t, pos[i] = i;         continue;       }       d = gcd(cnt, a[t]);       work(cnt / d, a[t] / d);     }     for (int i = 0; i < n; i++)       if (a[id[i]] & 1) {         t = id[i];         if (len == 0) {           len = a[t];           cnt = len;           for (int i = 1; i <= len; i++) ans[i] = t, pos[i] = i;           continue;         }         d = gcd(cnt, a[t]);         work2(cnt / d, a[t] / d);         cnt = d;       }     printf( %d n , cnt);     for (int i = 1; i <= len; i++) printf( %c ,  a  + ans[i]);     return 0;   }   