#include <iostream>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std;

#define in cin
#define out cout
#define dout if(true) cout
/*
int prime[1010];
int P;

void gen_primes()
{
	P = 0;
	for (int i=2;i<=1000;i++){
		bool is_prime = true;
		for (int j=0;j<P;j++){
			if (i%prime[j] == 0){
				is_prime = false;
				break;
			}
		}
		if (is_prime){
			prime[P++] = i;
		}
	}
}
*/
#define ASCII 300
int amt[ASCII];

char final[1010];

priority_queue< pair<int,char> > sortamt;

int P[1010];
int R[1010];

int find(int i)
{
	if (P[i] == i) return i;
	return find(P[i]);
}

bool connected(int i, int j)
{
	return find(i) == find(j);
}

void join(int i, int j){
	if (connected(i,j)) return;

	int x = find(i);
	int y = find(j);

	if (R[x] < R[y]){
		P[x] = y;
		R[y] += R[x];
	}else{
		P[y] = x;
		R[x] += R[y];
	}
}

char cmp[1010];

int gcd(int a, int b)
{
	if (a==0) return b;
	if (b==0) return a;

	return gcd(b,a%b);
}

int lcm(int a, int b)
{
	return a*b/gcd(a,b);
}

int main()
{
	//gen_primes();
	string s;
	in >> s;

	int N = s.size();
	s = "0" + s;

	for (int i=1;i<=N;i++){
		P[i] = i;
		R[i] = 1;
	}

	for (int i=2;i<=N;i++){
		for (int j=2;j<=N;j++){
			if (N>=lcm(i,j)){
				join(i,j);
			}
		}
	}

	for (int i=1;i<=N;i++){
		amt[s[i]]++;
	}

	for (char c='a';c<='z';c++){
		sortamt.push(make_pair(amt[c],c));
	}

	bool good = true;
	for (int i=2;i<=N && good;i++){
		int c = find(i);
		if (cmp[c] != 0) continue;
		pair<int,char> pr = sortamt.top();
		sortamt.pop();
		cmp[c] = pr.second;

		for (int j=i;j<=N;j++){
			if (find(j) == c){
				if (pr.first == 0) {
					good = false;
					break;
				}
				final[j] = cmp[c];
				pr.first--;
			}
		}

		if (pr.first > 0){
			sortamt.push(pr);
		}
	}

	if (!sortamt.empty()){
		pair<int,char> pr = sortamt.top();
		sortamt.pop();
		cmp[1] = pr.second;

		if (pr.first == 0){
			good = false;
		}
		else{
			final[1] = cmp[1];
			pr.first--;
		}

		if (pr.first > 0){
			sortamt.push(pr);
		}
	}

	for (int i=1;i<=N;i++){
		if (final[i] == 0){
			good = false;
		}
	}

	final[N+1] = 0;
	if (good){
		cout << "YES" << endl;
		printf("%s\n",final+1);
	}
	else{
		cout << "NO" << endl;
	}

	return 0;
	//sort(sortamt.begin(),sortamt.end());
	/*
	bool good = true;
	int i = sortamt.size()-1;
	for (int p=0;p<P;p++){
		int f = N/prime[p];
		if (f == 0) break;
		pair<int,char> pr = sortamt.top();
		sortamt.pop();

		if (pr.first < f){
			good = false;
			break;
		}

		for (int j=prime[p];j<=f*prime[p];j+=prime[p]){
			final[j] = pr.second;
			pr.first--;
		}

		sortamt.push(pr);
	}*/
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std;

#define in cin
#define out cout
#define dout if(true) cout
/*
int prime[1010];
int P;

void gen_primes()
{
	P = 0;
	for (int i=2;i<=1000;i++){
		bool is_prime = true;
		for (int j=0;j<P;j++){
			if (i%prime[j] == 0){
				is_prime = false;
				break;
			}
		}
		if (is_prime){
			prime[P++] = i;
		}
	}
}
*/
#define ASCII 300
int amt[ASCII];

char final[1010];

priority_queue< pair<int,char> > sortamt;

int P[1010];
int R[1010];

int find(int i)
{
	if (P[i] == i) return i;
	return find(P[i]);
}

bool connected(int i, int j)
{
	return find(i) == find(j);
}

void join(int i, int j){
	if (connected(i,j)) return;

	int x = find(i);
	int y = find(j);

	if (R[x] < R[y]){
		P[x] = y;
		R[y] += R[x];
	}else{
		P[y] = x;
		R[x] += R[y];
	}
}

char cmp[1010];

int gcd(int a, int b)
{
	if (a==0) return b;
	if (b==0) return a;

	return gcd(b,a%b);
}

int lcm(int a, int b)
{
	return a*b/gcd(a,b);
}

int main()
{
	//gen_primes();
	string s;
	in >> s;

	int N = s.size();
	s = "0" + s;

	for (int i=1;i<=N;i++){
		P[i] = i;
		R[i] = 1;
	}

	for (int i=2;i<=N;i++){
		for (int j=2;j<=N;j++){
			if (N>=lcm(i,j)){
				join(i,j);
			}
		}
	}

	for (int i=1;i<=N;i++){
		amt[s[i]]++;
	}

	for (char c='a';c<='z';c++){
		sortamt.push(make_pair(amt[c],c));
	}

	bool good = true;
	for (int i=1;i<=N && good;i++){
		int c = find(i);
		if (cmp[c] != 0) continue;
		pair<int,char> pr = sortamt.top();
		sortamt.pop();
		cmp[c] = pr.second;

		for (int j=i;j<=N;j++){
			if (find(j) == c){
				if (pr.first == 0) {
					good = false;
					break;
				}
				final[j] = cmp[c];
				pr.first--;
			}
		}

		if (pr.first > 0){
			sortamt.push(pr);
		}
	}

	for (int i=1;i<=N;i++){
		if (final[i] == 0){
			good = false;
		}
	}

	final[N+1] = 0;
	if (good){
		cout << "YES" << endl;
		printf("%s\n",final+1);
	}
	else{
		cout << "NO" << endl;
	}

	return 0;
	//sort(sortamt.begin(),sortamt.end());
	/*
	bool good = true;
	int i = sortamt.size()-1;
	for (int p=0;p<P;p++){
		int f = N/prime[p];
		if (f == 0) break;
		pair<int,char> pr = sortamt.top();
		sortamt.pop();

		if (pr.first < f){
			good = false;
			break;
		}

		for (int j=prime[p];j<=f*prime[p];j+=prime[p]){
			final[j] = pr.second;
			pr.first--;
		}

		sortamt.push(pr);
	}*/
}


#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <cassert>

using namespace std;

#define in cin
#define out cout
#define dout if(true) cout

struct message
{
	string a,b;
	int t;
};

#define MAXN 2010

message M[MAXN];

map<string,int> ID;
string name[MAXN];
int P;
bool friends[MAXN][MAXN];

int H(string s)
{
	int x = ID[s];
	if (x==0){
		P++;
		x = ID[s] = P;
		name[x] = s;
	}

	return x;
}

int main()
{
	int N,D;
	in >> N >> D;
	for (int i=0;i<N;i++){
		string a,b;
		int t;
		in >> a >> b >> t;
		M[i].a = a;
		M[i].b = b;
		M[i].t = t;

		int x = H(a);
		int y = H(b);

		for (int j=0;j<i;j++){
			if (M[j].b == M[i].a){
				if (M[j].a == M[i].b){
					int dist = abs(M[i].t-M[j].t);
					if (0<dist&&dist<=D){
						friends[x][y] = friends[y][x] = true;
					}
				}
			}
		}
	}

	int ans = 0;
	for (int i=1;i<=P;i++){
		for (int j=i+1;j<=P;j++){
			if (friends[i][j]){
				ans++;
			}
		}
	}

	cout << ans << endl;

	for (int i=1;i<=P;i++){
		for (int j=i+1;j<=P;j++){
			if (friends[i][j]){
				cout << name[i] << " " << name[j] << endl;
			}
		}
	}
}


#include <iostream>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std;

#define in cin
#define out cout
#define dout if(true) cout
/*
int prime[1010];
int P;

void gen_primes()
{
	P = 0;
	for (int i=2;i<=1000;i++){
		bool is_prime = true;
		for (int j=0;j<P;j++){
			if (i%prime[j] == 0){
				is_prime = false;
				break;
			}
		}
		if (is_prime){
			prime[P++] = i;
		}
	}
}
*/
#define ASCII 300
int amt[ASCII];

char final[1010];

priority_queue< pair<int,char> > sortamt;

int P[1010];
int R[1010];

int find(int i)
{
	if (P[i] == i) return i;
	return find(P[i]);
}

bool connected(int i, int j)
{
	return find(i) == find(j);
}

void join(int i, int j){
	if (connected(i,j)) return;

	int x = find(i);
	int y = find(j);

	if (R[x] < R[y]){
		P[x] = y;
		R[y] += R[x];
	}else{
		P[y] = x;
		R[x] += R[y];
	}
}

char cmp[1010];

int gcd(int a, int b)
{
	if (a==0) return b;
	if (b==0) return a;

	return gcd(b,a%b);
}

int lcm(int a, int b)
{
	return a*b/gcd(a,b);
}

int main()
{
	//gen_primes();
	string s;
	in >> s;

	int N = s.size();
	s = "0" + s;

	for (int i=1;i<=N;i++){
		P[i] = i;
		R[i] = 1;
	}

	for (int i=2;i<=N;i++){
		for (int j=2;j<=N;j++){
			if (N>=lcm(i,j)){
				join(i,j);
			}
		}
	}

	for (int i=1;i<=N;i++){
		amt[s[i]]++;
	}

	for (char c='a';c<='z';c++){
		sortamt.push(make_pair(amt[c],c));
	}

	bool good = true;
	for (int i=1;i<=N && good;i++){
		int c = find(i);
		if (cmp[c] != 0) continue;
		pair<int,char> pr = sortamt.top();
		sortamt.pop();
		cmp[c] = pr.second;

		for (int j=i;j<=N;j++){
			if (find(j) == c){
				if (pr.first == 0) {
					good = false;
					break;
				}
				final[j] = cmp[c];
				pr.first--;
			}
		}

		if (pr.first > 0){
			sortamt.push(pr);
		}
	}

	for (int i=1;i<=N;i++){
		if (final[i] == 0){
			good = false;
		}
	}

	final[N+1] = 0;
	if (good){
		cout << "YES" << endl;
		printf("%s\n",final+1);
	}
	else{
		cout << "NO" << endl;
	}

	return 0;
	//sort(sortamt.begin(),sortamt.end());
	/*
	bool good = true;
	int i = sortamt.size()-1;
	for (int p=0;p<P;p++){
		int f = N/prime[p];
		if (f == 0) break;
		pair<int,char> pr = sortamt.top();
		sortamt.pop();

		if (pr.first < f){
			good = false;
			break;
		}

		for (int j=prime[p];j<=f*prime[p];j+=prime[p]){
			final[j] = pr.second;
			pr.first--;
		}

		sortamt.push(pr);
	}*/
}


#include<iostream>
#include<cstdio>
#include<cstring>
#define N 1005
using namespace std;
int prime[N],use[30],vis[N],belong[N],parent[N],pos[N][N];
char st[N],ans[N];
int num,len;
bool isprime(int n)
{
	for(int i=0;prime[i]*prime[i]<=n;i++)
		if(n%prime[i]==0)
			return 0;
	return 1;
}
void init()
{
	int i;
	prime[0]=2;
	for(i=3;i<N;i++)
		if(isprime(i))
			prime[++num]=i;
}
int Find(int x)
{
	if(x!=parent[x])
		parent[x]=Find(parent[x]);
	return parent[x];
}
void Union(int x,int y)
{
	int i,j;
	i=Find(x);
	j=Find(y);
	if(i!=j)
	{
		if(parent[i]>parent[j])
			parent[i]=j;
		else
			parent[j]=i;
	}
}
void solve()
{
	int i,j,k;
	len=strlen(st+1);
	for(i=0;i<=len;i++)
		parent[i]=i;
	for(i=0;prime[i]<len;i++)
		for(j=2;j*prime[i]<=len;j++)
			Union(prime[i],j*prime[i]);
	for(i=1;i<=len;i++)
	{
		j=Find(i);
		pos[j][++pos[j][0]]=i;
	}
	for(i=1;i<=len;i++)
		belong[parent[i]]++;
	for(i=1;i<=len;i++)
		use[st[i]-'a']++;
	for(i=1;i<=len/2;i++)
		if(belong[i]>1)
		{
			k=-1;
			for(j=0;j<26;j++)
				if(use[j]>=belong[i])
				{
					if(k==-1||use[k]>use[j])
						k=j;
				}
			if(k==-1)
			{
				cout<<"NO"<<endl;
				return ;
			}
			for(j=1;j<=pos[i][0];j++)
			{
				ans[pos[i][j]]='a'+k;
				vis[pos[i][j]]=1;
			}
			use[k]-=belong[i];
		}
	for(j=1;j<=len;j++)
		if(!vis[j])
			for(i=0;i<26;i++)
				if(use[i])
				{
					use[i]--;
					ans[j]='a'+i;
					break;
				}
	ans[len+1]='\0';
	printf("YES\n%s\n",ans+1);
}
int main()
{
	scanf("%s",st+1);
	init();
	solve();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#define N 1005
using namespace std;
int prime[N],use[30],vis[N],belong[N],parent[N],pos[N][N];
char st[N],ans[N];
int num,len;
bool isprime(int n)
{
	for(int i=0;prime[i]*prime[i]<=n;i++)
		if(n%prime[i]==0)
			return 0;
	return 1;
}
void init()
{
	int i;
	prime[0]=2;
	for(i=3;i<N;i++)
		if(isprime(i))
			prime[++num]=i;
}
int Find(int x)
{
	if(x!=parent[x])
		parent[x]=Find(parent[x]);
	return parent[x];
}
void Union(int x,int y)
{
	int i,j;
	i=Find(x);
	j=Find(y);
	if(i!=j)
	{
		if(parent[i]>parent[j])
			parent[i]=j;
		else
			parent[j]=i;
	}
}
void solve()
{
	int i,j,k;
	len=strlen(st+1);
	for(i=0;i<=len;i++)
		parent[i]=i;
	for(i=0;prime[i]<len;i++)
		for(j=2;j*prime[i]<=len;j++)
			Union(prime[i],j*prime[i]);
	for(i=1;i<=len;i++)
	{
		j=Find(i);
		pos[j][++pos[j][0]]=i;
	}
	for(i=1;i<=len;i++)
		belong[parent[i]]++;
	for(i=1;i<=len;i++)
		use[st[i]-'a']++;
	for(i=1;i<=len;i++)
		if(belong[i]>1)
		{
			k=-1;
			for(j=0;j<26;j++)
				if(use[j]>=belong[i])
				{
					if(k==-1||use[k]>use[j])
						k=j;
				}
			if(k==-1)
			{
				cout<<"NO"<<endl;
				return ;
			}
			for(j=1;j<=pos[i][0];j++)
			{
				ans[pos[i][j]]='a'+k;
				vis[pos[i][j]]=1;
			}
			use[k]-=belong[i];
		}
	for(j=1;j<=len;j++)
		if(!vis[j])
			for(i=0;i<26;i++)
				if(use[i])
				{
					use[i]--;
					ans[j]='a'+i;
					break;
				}
	ans[len+1]='\0';
	printf("YES\n%s\n",ans+1);
}
int main()
{
	scanf("%s",st+1);
	init();
	solve();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#define N 1005
using namespace std;
int prime[N],use[30],vis[N];
char st[N],ans[N];
int num,len;
bool isprime(int n)
{
	for(int i=0;prime[i]*prime[i]<=n;i++)
		if(n%prime[i]==0)
			return 0;
	return 1;
}
void init()
{
	int i;
	prime[0]=2;
	for(i=3;i<N;i++)
		if(isprime(i))
			prime[++num]=i;
}
void solve()
{
	int i,j,k;
	len=strlen(st+1);
	for(i=1;i<=len;i++)
		use[st[i]-'a']++;
	for(j=i=0;i<26;i++)
		if(use[j]<use[i])
			j=i;
	for(i=0;prime[i]<=len/2;i++)
	{
		for(k=prime[i];k<=len;k+=prime[i])
			if(!ans[k])
			{
				if(use[j])
				{
					ans[k]='a'+j;
					use[j]--;
				}
				else
				{
				cout<<"NO"<<endl;
				return ;
				}
			}
	}
	for(i=1;i<=len;i++)
		if(!ans[i])
		{
			for(j=0;j<26;j++)
				if(use[j])
				{
					ans[i]=j+'a';
					use[j]--;
					break;
				}
		}
	ans[len+1]='\0';
	printf("YES\n%s\n",ans+1);
}
int main()
{
	scanf("%s",st+1);
	init();
	solve();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#define N 1005
using namespace std;
int prime[N],use[30],vis[N],belong[N],parent[N],pos[N][N];
char st[N],ans[N];
int num,len;
bool isprime(int n)
{
	for(int i=0;prime[i]*prime[i]<=n;i++)
		if(n%prime[i]==0)
			return 0;
	return 1;
}
void init()
{
	int i;
	prime[0]=2;
	for(i=3;i<N;i++)
		if(isprime(i))
			prime[++num]=i;
}
int Find(int x)
{
	if(x!=parent[x])
		parent[x]=Find(parent[x]);
	return parent[x];
}
void Union(int x,int y)
{
	int i,j;
	i=Find(x);
	j=Find(y);
	if(i!=j)
	{
		if(parent[i]>parent[j])
			parent[i]=j;
		else
			parent[j]=i;
	}
}
void solve()
{
	int i,j,k;
	len=strlen(st+1);
	for(i=0;i<=len;i++)
		parent[i]=i;
	for(i=0;prime[i]<len;i++)
		for(j=2;j*prime[i]<=len;j++)
			Union(prime[i],j*prime[i]);
	for(i=1;i<=len;i++)
	{
		j=Find(i);
		pos[j][++pos[j][0]]=i;
	}
	for(i=1;i<=len;i++)
		belong[parent[i]]++;
	for(i=1;i<=len;i++)
		use[st[i]-'a']++;
	for(i=1;i<=len/2;i++)
		if(belong[i]>1)
		{
			k=-1;
			for(j=0;j<26;j++)
				if(use[j]>=belong[i])
				{
					if(k==-1||use[k]>use[j])
						k=j;
				}
			if(k==-1)
			{
				cout<<"NO"<<endl;
				return ;
			}
			for(j=1;j<=pos[i][0];j++)
			{
				ans[pos[i][j]]='a'+k;
				vis[pos[i][j]]=1;
			}
			use[k]-=belong[i];
			break;
		}
	for(j=1;j<=len;j++)
		if(!vis[j])
			for(i=0;i<26;i++)
				if(use[i])
				{
					use[i]--;
					ans[j]='a'+i;
					break;
				}
	ans[len+1]='\0';
	printf("YES\n%s\n",ans+1);
}
int main()
{
	scanf("%s",st+1);
	init();
	solve();
	return 0;
}


#include <bits/stdc++.h>
#define fore(i,n) for(long long i = 0; i< n ; i++ )
#define lop(i,n) for(long long i = 1 ; i<=n ; i++ )
#define ops(i,n) for(long long  i = n-1 ; i>=0 ; i-- )
#define MAX 100001
#define MOD 1000000007
#define r(input) freopen("input.in","r",stdin)
#define w(output) freopen("output.out","w",stdout)
#define mp make_pair
#define EPS 1e-8

#define B 13
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>pii;
typedef pair<long long,long long>pll;
typedef vector<int> vi;
typedef vector<ll> vll;

bool np[2005];
vi prime;
int f[200];
void sieve(int n){
    np[0]=true;
    np[1]=true;
    for(int i=2;i*i<=n;i++){
        if(!np[i]){
            for(int j=i*i;j<=n;j+=i)np[j]=true;
        }
    }
    lop(i,n)if(!np[i])prime.push_back(i);
}

int main(){
    string s;
    cin >> s;
    fore(i,s.length()){
        f[s[i]]++;
        s[i]='*';
    }
    int l=s.size();
    vector<pair<int,char> > v;
    for(int i='a';i<='z';i++){
        v.push_back(mp(f[i],char(i)));
    }
    sort(v.rbegin(),v.rend());
    sieve(s.size());
    fore(i,prime.size()){
        if(l/prime[i]<=1)break;
        int k=l/prime[i];
        if(v[0].first<k)return cout << "No",0;
        int o=0;
        for(int j=1;j<=k;j++){
            if(s[(j*prime[i])-1]=='*')s[(j*prime[i])-1]=v[0].second,o++;
            else if(s[(j*prime[i])-1]!=v[0].second)return cout << "No",0;
        }
        v[0].first-=o;
        f[v[0].second]-=o;
        sort(v.rbegin(),v.rend());
    }
    fore(i,s.size()){
        if(s[i]=='*'){
            for(int j='a';j<='z';j++)if(f[j]){s[i]=char(j),f[j]--;break;}
        }
    }
    cout << "YES\n";
    cout << s;
    return 0;
}


#include <bits/stdc++.h>
#define fore(i,n) for(long long i = 0; i< n ; i++ )
#define lop(i,n) for(long long i = 1 ; i<=n ; i++ )
#define ops(i,n) for(long long  i = n-1 ; i>=0 ; i-- )
#define MAX 100001
#define MOD 1000000007
#define r(input) freopen("input.in","r",stdin)
#define w(output) freopen("output.out","w",stdout)
#define mp make_pair
#define EPS 1e-8

#define B 13
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>pii;
typedef pair<long long,long long>pll;
typedef vector<int> vi;
typedef vector<ll> vll;

bool np[2005];
vi prime;
int f[200];
void sieve(int n){
    np[0]=true;
    np[1]=true;
    for(int i=2;i*i<=n;i++){
        if(!np[i]){
            for(int j=i*i;j<=n;j+=i)np[j]=true;
        }
    }
    lop(i,n)if(!np[i])prime.push_back(i);
}

int main(){
    string s;
    cin >> s;
    fore(i,s.length()){
        f[s[i]]++;
        s[i]='*';
    }
    int l=s.size();
    vector<pair<int,char> > v;
    for(int i='a';i<='z';i++){
        v.push_back(mp(f[i],char(i)));
    }
    sort(v.rbegin(),v.rend());
    sieve(s.size());
    fore(i,prime.size()){
        if(l/prime[i]<=1)break;
        int k=l/prime[i];
        if(v[0].first<k)return cout << "NO",0;
        int o=0;
        for(int j=1;j<=k;j++){
            if(s[(j*prime[i])-1]=='*')s[(j*prime[i])-1]=v[0].second,o++;
            else if(s[(j*prime[i])-1]!=v[0].second)return cout << "NO",0;
        }
        v[0].first-=o;
        f[v[0].second]-=o;
        sort(v.rbegin(),v.rend());
    }
    fore(i,s.size()){
        if(s[i]=='*'){
            for(int j='a';j<='z';j++)if(f[j]){s[i]=char(j),f[j]--;break;}
        }
    }
    cout << "YES\n";
    cout << s;
    return 0;
}


#include <bits/stdc++.h>
#define fore(i,n) for(long long i = 0; i< n ; i++ )
#define lop(i,n) for(long long i = 1 ; i<=n ; i++ )
#define ops(i,n) for(long long  i = n-1 ; i>=0 ; i-- )
#define MAX 100001
#define MOD 1000000007
#define r(input) freopen("input.in","r",stdin)
#define w(output) freopen("output.out","w",stdout)
#define mp make_pair
#define EPS 1e-8

#define B 13
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>pii;
typedef pair<long long,long long>pll;
typedef vector<int> vi;
typedef vector<ll> vll;

bool np[2005];
int cp[2005];
vi prime;
int f[200];
void sieve(int n){
    np[0]=true;
    np[1]=true;
    for(int i=2;i*i<=n;i++){
        if(!np[i]){
            for(int j=i*i;j<=n;j+=i)np[j]=true;
        }
    }
    lop(i,n)if(!np[i])prime.push_back(i);
}

int main(){
    string s;
    cin >> s;
    fore(i,s.length()){
        f[s[i]]++;
        s[i]='*';
    }
    int l=s.size();
    vector<pair<int,char> > v;
    for(int i='a';i<='z';i++){
        v.push_back(mp(f[i],char(i)));
    }
    sort(v.rbegin(),v.rend());
    sieve(s.size());
    int ff=prime.size();
    fore(i,ff){
        //if(l/prime[i]<=1)break;
        if(!cp[prime[i]]){
            int k=l/prime[i];
            if(v[0].first<k)return cout << "NO",0;
            int o=0;
            for(int j=1;j<=k;j++){
                if(!np[j])cp[j]=v[0].second;
                if(s[(j*prime[i])-1]=='*'){
                    s[(j*prime[i])-1]=v[0].second,o++;
                    if(f[v[0].second]-o<0)return cout << "NO",0;
                }
                else if(s[(j*prime[i])-1]!=v[0].second)return cout << "NO",0;
            }
            v[0].first-=o;
            f[v[0].second]-=o;
        }
        else{
            //cout << char(cp[prime[i]]) << "\n";
            int idx=0;
            fore(k,v.size()){
              //  cout << v[k].first << " "<< v[k].second << "\n";
                if(char(cp[prime[i]])==v[k].second)idx=k;
            }
            int k=l/prime[i];
            //if(v[idx].first<k)return cout << "NO",0;
            int o=0;
            for(int j=1;j<=k;j++){
                if(!np[j])cp[j]=v[idx].second;
                if(s[(j*prime[i])-1]=='*'){
                        s[(j*prime[i])-1]=v[idx].second,o++;
                        if(f[v[idx].second]-o<0)return cout << "NO",0;
                }
                else if(s[(j*prime[i])-1]!=v[idx].second)return cout << "NO",0;
            }
            v[idx].first-=o;
            f[v[idx].second]-=o;
        }
        sort(v.rbegin(),v.rend());
    }
    fore(i,s.size()){
        if(s[i]=='*'){
            for(int j='a';j<='z';j++)if(f[j]){s[i]=char(j),f[j]--;break;}
        }
    }
    cout << "YES\n";
    cout << s;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <deque>
#include <vector>
#include <cstdlib>

#define pb push_back
#define mp make_pair
#define fs first
#define sc second

using namespace std;

typedef long long int64;
typedef long double extended;

const char* fin = "input.txt";
const char* fout = "output.txt";

bool prime(int p){
    for (int i = 2; i * i <= p; i++)
        if (p % i == 0)
            return i;
    return 0;
}

string s;
vector<int> a, sa;
vector<pair<int, char> > ss;
vector<pair<int, int> > c;
map<int, char> mpp;
set<int> exprime;

int main()
{
    //freopen(fin, "r", stdin);
    //freopen(fout, "w", stdout);
    cin >> s;
    sort(s.begin(), s.end());
    ss.pb(mp(1, s[0]));
    for (int i = 1; i < s.size(); i++)
        if (s[i] == s[i-1])
            ss[ss.size()-1].fs++;
        else
            ss.pb(mp(1, s[i]));
    sort(ss.rbegin(), ss.rend());
    a.assign(s.size(), 0);
    a[0] = 1;
    int cnt = 3;
    for (int i = 2; i <= s.size(); i++)
        if (!prime(i) && i * 2 > s.size())
            exprime.insert(i);
    for (int i = 2; i <= s.size(); i++)
        if (exprime.find(i) != exprime.end())
            a[i-1] = cnt++;
        else
            a[i-1] = 2;
    for (int i = 0; i < s.size(); i++)
        sa.pb(a[i]);
    sort(sa.begin(), sa.end());
    c.pb(mp(1, sa[0]));
    for (int i = 1; i < sa.size(); i++)
        if (sa[i] == sa[i-1])
            c[c.size()-1].fs++;
        else
            c.pb(mp(1, sa[i]));
    sort(c.rbegin(), c.rend());
    for (int i = 0; i < c.size(); i++){
        bool flag = false;
        for (int j = 0; j < ss.size(); j++)
            if (ss[j].fs >= c[i].fs){
                ss[j].fs -= c[i].fs;
                mpp[c[i].sc] = ss[j].sc;
                flag = true;
                break;
            }
        sort(ss.begin(), ss.end());
        if (!flag){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES\n";
    for (int i = 0; i < s.size(); i++)
        cout << mpp[a[i]];
    cout << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <deque>
#include <vector>
#include <cstdlib>

#define pb push_back
#define mp make_pair
#define fs first
#define sc second

using namespace std;

typedef long long int64;
typedef long double extended;

const char* fin = "input.txt";
const char* fout = "output.txt";

bool prime(int p){
    for (int i = 2; i * i <= p; i++)
        if (p % i == 0)
            return i;
    return 0;
}

string s;
vector<int> a, sa;
vector<pair<int, char> > ss;
vector<pair<int, int> > c;
map<int, char> mpp;

int main()
{
    //freopen(fin, "r", stdin);
    //freopen(fout, "w", stdout);
    cin >> s;
    sort(s.begin(), s.end());
    ss.pb(mp(1, s[0]));
    for (int i = 1; i < s.size(); i++)
        if (s[i] == s[i-1])
            ss[ss.size()-1].fs++;
        else
            ss.pb(mp(1, s[i]));
    sort(ss.rbegin(), ss.rend());
    a.assign(s.size(), 0);
    a[0] = 1;
    int cnt = 2;
    for (int i = 2; i <= s.size(); i++){
        int d = prime(i);
        if (d != 0)
            a[i-1] = a[d];
        else
            a[i-1] = cnt++;
    }
    for (int i = 0; i < s.size(); i++)
        sa.pb(a[i]);
    sort(sa.begin(), sa.end());
    c.pb(mp(1, sa[0]));
    for (int i = 1; i < sa.size(); i++)
        if (sa[i] == sa[i-1])
            c[c.size()-1].fs++;
        else
            c.pb(mp(1, sa[i]));
    sort(c.rbegin(), c.rend());
    for (int i = 0; i < c.size(); i++){
        bool flag = false;
        for (int j = 0; j < ss.size(); j++)
            if (ss[j].fs >= c[i].fs){
                ss[j].fs -= c[i].fs;
                mpp[c[i].sc] = ss[j].sc;
                flag = true;
                break;
            }
        sort(ss.begin(), ss.end());
        if (!flag){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES\n";
    for (int i = 0; i < s.size(); i++)
        cout << mpp[a[i]];
    cout << endl;
    return 0;
}


#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

const int MAXN = 1050;
vector <int> primes;
int np[MAXN], cnt[26];
char str[MAXN], ans[MAXN];

int main()
{
    scanf("%s", str);
    int len = strlen(str);

    if(len==1)
    {
        printf("YES\n");
        printf("%s\n", str);
        return 0;
    }

    //primes.push_back(2);
    np[0] |= 3;
    for(int i = 2; i <= len; i++)
        if( (np[i>>5]&(1<<(i&31))) == 0 )
        {
            primes.push_back(i);
            for(int j = i<<1; j < MAXN; j+=i)
                np[j>>5] |= 1<<(j&31);
        }

    for(int i = 0; i < len; i++)
        ++cnt[ str[i] - 'a' ];

    int theMax = 0, maxc = 0;
    for(int i = 0; i < 26; i++)
        if(cnt[i] > theMax)
            theMax = cnt[i], maxc = i;

    bool failFlag = false;
    memset(ans, 0, sizeof(ans));
    for(int i = 2; i <= len; i+=2)
        if(cnt[ maxc ] > 0)
        {
            ans[i-1] = maxc+'a';
            --cnt[maxc];
        }
        else
        {
            failFlag = true;
            break;
        }

    for(int i = 1; i < primes.size() && !failFlag; i++)
    {
        int p = primes[i];

        if(primes[i]*2 <= len) //must be the same as s2, NOTICE you can only fail in this case only!
        {
            for(int i = p; i <= len; i+=p)
                if(ans[i-1]==0)
                {
                    if(cnt[ maxc ] > 0)
                    {
                        ans[i-1] = maxc+'a';
                        --cnt[maxc];
                    }
                    else
                    {
                        failFlag = true;
                        break;
                    }
                }
        }
        else //you can choose one character freely
        {
            for(int j = 0; j < 26; j++)
                if(cnt[j] > 0 && j != maxc)
                {
                    ans[p-1] = j+'a';
                    --cnt[j];
                    break;
                }

            if(ans[p-1] == 0)
            {
                ans[p-1] = maxc+'a';//no other character
                --cnt[maxc];
            }
        }
    }

    for(int i = 0; i < 26; i++) //deciding first character
        if(cnt[i] > 0)
        {
            ans[0] = i+'a';
            break;
        }

    printf("%s\n", failFlag ? "NO" : "YES");
    if(!failFlag)
    {
        for(int i = 0; i < len; i++)
            printf("%c", ans[i]);
        printf("\n");
    }

    getchar();getchar();
    return 0;
}


#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

const int MAXN = 1050;
vector <int> primes;
int np[MAXN], cnt[26];
char str[MAXN], ans[MAXN];

int main()
{
    scanf("%s", str);
    int len = strlen(str);

    if(len==1)
    {
        printf("%s\n", str);
        return 0;
    }

    //primes.push_back(2);
    np[0] |= 3;
    for(int i = 2; i <= len; i++)
        if( (np[i>>5]&(1<<(i&31))) == 0 )
        {
            primes.push_back(i);
            for(int j = i<<1; j < MAXN; j+=i)
                np[j>>5] |= 1<<(j&31);
        }

    for(int i = 0; i < len; i++)
        ++cnt[ str[i] - 'a' ];

    int theMax = 0, maxc = 0;
    for(int i = 0; i < 26; i++)
        if(cnt[i] > theMax)
            theMax = cnt[i], maxc = i;

    bool failFlag = false;
    memset(ans, 0, sizeof(ans));
    for(int i = 2; i <= len; i+=2)
        if(cnt[ maxc ] > 0)
        {
            ans[i-1] = maxc+'a';
            --cnt[maxc];
        }
        else
        {
            failFlag = true;
            break;
        }

    for(int i = 1; i < primes.size() && !failFlag; i++)
    {
        int p = primes[i];

        if(primes[i]*2 < len) //must be the same as s2, NOTICE you can only fail in this case only!
        {
            for(int i = p; i <= len; i+=p)
                if(ans[i-1]==0)
                {
                    if(cnt[ maxc ] > 0)
                    {
                        ans[i-1] = maxc+'a';
                        --cnt[maxc];
                    }
                    else
                    {
                        failFlag = true;
                        break;
                    }
                }
        }
        else //you can choose one character freely
        {
            for(int j = 0; j < 26; j++)
                if(cnt[j] > 0 && j != maxc)
                {
                    ans[p-1] = j+'a';
                    --cnt[j];
                    break;
                }

            if(ans[p-1] == 0)
            {
                ans[p-1] = maxc+'a';//no other character
                --cnt[maxc];
            }
        }
    }

    for(int i = 0; i < 26; i++) //deciding first character
        if(cnt[i] > 0)
        {
            ans[0] = i+'a';
            break;
        }

    printf("%s\n", failFlag ? "NO" : "YES");
    if(!failFlag)
    {
        for(int i = 0; i < len; i++)
            printf("%c", ans[i]);
        printf("\n");
    }

    getchar();getchar();
    return 0;
}


#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

const int MAXN = 1050;
vector <int> primes;
int np[MAXN], cnt[26];
char str[MAXN], ans[MAXN];

int main()
{
    scanf("%s", str);
    int len = strlen(str);

    if(len==1)
    {
        printf("%s\n", str);
        return 0;
    }

    //primes.push_back(2);
    np[0] |= 3;
    for(int i = 2; i <= len; i++)
        if( (np[i>>5]&(1<<(i&31))) == 0 )
        {
            primes.push_back(i);
            for(int j = i<<1; j < MAXN; j+=i)
                np[j>>5] |= 1<<(j&31);
        }

    for(int i = 0; i < len; i++)
        ++cnt[ str[i] - 'a' ];

    int theMax = 0, maxc = 0;
    for(int i = 0; i < 26; i++)
        if(cnt[i] > theMax)
            theMax = cnt[i], maxc = i;

    bool failFlag = false;
    memset(ans, 0, sizeof(ans));
    for(int i = 2; i <= len; i+=2)
        if(cnt[ maxc ] > 0)
        {
            ans[i-1] = maxc+'a';
            --cnt[maxc];
        }
        else
        {
            failFlag = true;
            break;
        }

    for(int i = 1; i < primes.size() && !failFlag; i++)
    {
        int p = primes[i];

        if(primes[i]*2 <= len) //must be the same as s2, NOTICE you can only fail in this case only!
        {
            for(int i = p; i <= len; i+=p)
                if(ans[i-1]==0)
                {
                    if(cnt[ maxc ] > 0)
                    {
                        ans[i-1] = maxc+'a';
                        --cnt[maxc];
                    }
                    else
                    {
                        failFlag = true;
                        break;
                    }
                }
        }
        else //you can choose one character freely
        {
            for(int j = 0; j < 26; j++)
                if(cnt[j] > 0 && j != maxc)
                {
                    ans[p-1] = j+'a';
                    --cnt[j];
                    break;
                }

            if(ans[p-1] == 0)
            {
                ans[p-1] = maxc+'a';//no other character
                --cnt[maxc];
            }
        }
    }

    for(int i = 0; i < 26; i++) //deciding first character
        if(cnt[i] > 0)
        {
            ans[0] = i+'a';
            break;
        }

    printf("%s\n", failFlag ? "NO" : "YES");
    if(!failFlag)
    {
        for(int i = 0; i < len; i++)
            printf("%c", ans[i]);
        printf("\n");
    }

    getchar();getchar();
    return 0;
}


#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

const int MAXN = 1050;
vector <int> primes;
int np[MAXN], cnt[26];
char str[MAXN], ans[MAXN];

int main()
{
    scanf("%s", str);
    int len = strlen(str);

    if(len==1)
    {
        printf("%s\n", str);
        return 0;
    }

    //primes.push_back(2);
    np[0] |= 3;
    for(int i = 2; i <= len; i++)
        if( (np[i>>5]&(1<<(i&31))) == 0 )
        {
            primes.push_back(i);

            for(int j = i<<1; j < MAXN; j+=i)
                np[j>>5] |= 1<<(j&31);
        }

    for(int i = 0; i < len; i++)
        ++cnt[ str[i] - 'a' ];

    int theMax = 0, maxc = 0;
    for(int i = 0; i < 26; i++)
        if(cnt[i] > theMax)
            theMax = cnt[i], maxc = i;

    bool failFlag = false;
    memset(ans, 0, sizeof(ans));
    for(int i = 2; i <= len; i+=2)
        if(cnt[ maxc ] > 0)
        {
            ans[i-1] = maxc+'a';
            --cnt[maxc];
        }
        else
        {
            failFlag = true;
            break;
        }

    for(int i = 1; i < primes.size() && !failFlag; i++)
    {
        int p = primes[i];

        if(primes[i]*2 < len) //must be the same as s2, NOTICE you can only fail in this case only!
        {
            for(int i = p; i <= len; i+=p)
                if(cnt[ maxc ] > 0)
                {
                    ans[i-1] = maxc+'a';
                    --cnt[maxc];
                }
                else
                {
                    failFlag = true;
                    break;
                }
        }
        else //you can choose one character freely
        {
            for(int j = 0; j < 26; j++)
                if(cnt[j] > 0 && j != maxc)
                {
                    ans[p-1] = j+'a';
                    --cnt[j];
                    break;
                }

            if(ans[p-1] == 0)
            {
                ans[p-1] = maxc+'a';//no other character
            }
        }
    }

    for(int i = 0; i < 26; i++) //deciding first character
        if(cnt[i] > 0)
        {
            ans[0] = i+'a';
            break;
        }

    printf("%s\n", failFlag ? "NO" : "YES");
    if(!failFlag)
    {
        for(int i = 0; i < len; i++)
            printf("%c", ans[i]);
        printf("\n");
    }

    getchar();getchar();
    return 0;
}


#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

const int MAXN = 1050;
vector <int> primes;
int np[MAXN], cnt[26];
char str[MAXN], ans[MAXN];

int main()
{
    scanf("%s", str);
    int len = strlen(str);

    if(len==1)
    {
        printf("%s\n", str);
        return 0;
    }

    //primes.push_back(2);
    np[0] |= 3;
    for(int i = 2; i <= len; i++)
        if( (np[i>>5]&(1<<(i&31))) == 0 )
        {
            primes.push_back(i);
            for(int j = i<<1; j < MAXN; j+=i)
                np[j>>5] |= 1<<(j&31);
        }

    for(int i = 0; i < len; i++)
        ++cnt[ str[i] - 'a' ];

    int theMax = 0, maxc = 0;
    for(int i = 0; i < 26; i++)
        if(cnt[i] > theMax)
            theMax = cnt[i], maxc = i;

    bool failFlag = false;
    memset(ans, 0, sizeof(ans));
    for(int i = 2; i <= len; i+=2)
        if(cnt[ maxc ] > 0)
        {
            ans[i-1] = maxc+'a';
            --cnt[maxc];
        }
        else
        {
            failFlag = true;
            break;
        }

    for(int i = 1; i < primes.size() && !failFlag; i++)
    {
        int p = primes[i];

        if(primes[i]*2 < len) //must be the same as s2, NOTICE you can only fail in this case only!
        {
            for(int i = p; i <= len; i+=p)
                if(ans[i-1]==0)
                {
                    if(cnt[ maxc ] > 0)
                    {
                        ans[i-1] = maxc+'a';
                        --cnt[maxc];
                    }
                    else
                    {
                        failFlag = true;
                        break;
                    }
                }
        }
        else //you can choose one character freely
        {
            for(int j = 0; j < 26; j++)
                if(cnt[j] > 0 && j != maxc)
                {
                    ans[p-1] = j+'a';
                    --cnt[j];
                    break;
                }

            if(ans[p-1] == 0)
            {
                ans[p-1] = maxc+'a';//no other character
            }
        }
    }

    for(int i = 0; i < 26; i++) //deciding first character
        if(cnt[i] > 0)
        {
            ans[0] = i+'a';
            break;
        }

    printf("%s\n", failFlag ? "NO" : "YES");
    if(!failFlag)
    {
        for(int i = 0; i < len; i++)
            printf("%c", ans[i]);
        printf("\n");
    }

    getchar();getchar();
    return 0;
}

/*
Input
jjjjjjjjjjzjjjjjjjjjjjjjjjj

Output
NO

Answer
YES

jjjjjjjjjjjjjjjjjjjjjjzjjjj
*/


#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

const int MAXN = 1050;
vector <int> primes;
int np[MAXN], cnt[26];
char str[MAXN], ans[MAXN];

int main()
{
    scanf("%s", str);
    int len = strlen(str);

    if(len==1)
    {
        printf("YES\n");
        printf("%s\n", str);
        return 0;
    }

    //primes.push_back(2);
    np[0] |= 3;
    for(int i = 2; i <= len; i++)
        if( (np[i>>5]&(1<<(i&31))) == 0 )
        {
            primes.push_back(i);
            for(int j = i<<1; j < MAXN; j+=i)
                np[j>>5] |= 1<<(j&31);
        }

    for(int i = 0; i < len; i++)
        ++cnt[ str[i] - 'a' ];

    int theMax = 0, maxc = 0;
    for(int i = 0; i < 26; i++)
        if(cnt[i] > theMax)
            theMax = cnt[i], maxc = i;

    bool failFlag = false;
    memset(ans, 0, sizeof(ans));
    for(int i = 2; i <= len; i+=2)
        if(cnt[ maxc ] > 0)
        {
            ans[i-1] = maxc+'a';
            --cnt[maxc];
        }
        else
        {
            failFlag = true;
            break;
        }

    for(int i = 1; i < primes.size() && !failFlag; i++)
    {
        int p = primes[i];

        if(primes[i]*2 <= len) //must be the same as s2, NOTICE you can only fail in this case only!
        {
            for(int i = p; i <= len; i+=p)
                if(ans[i-1]==0)
                {
                    if(cnt[ maxc ] > 0)
                    {
                        ans[i-1] = maxc+'a';
                        --cnt[maxc];
                    }
                    else
                    {
                        failFlag = true;
                        break;
                    }
                }
        }
        else //you can choose one character freely
        {
            for(int j = 0; j < 26; j++)
                if(cnt[j] > 0 && j != maxc)
                {
                    ans[p-1] = j+'a';
                    --cnt[j];
                    break;
                }

            if(ans[p-1] == 0)
            {
                ans[p-1] = maxc+'a';//no other character
                --cnt[maxc];
            }
        }
    }

    for(int i = 0; i < 26; i++) //deciding first character
        if(cnt[i] > 0)
        {
            ans[0] = i+'a';
            break;
        }

    printf("%s\n", failFlag ? "NO" : "YES");
    if(!failFlag)
    {
        for(int i = 0; i < len; i++)
            printf("%c", ans[i]);
        printf("\n");
    }

    getchar();getchar();
    return 0;
}
/****** PCCA -Sat Nov 19 04:24:05 GMT 2011 *******/


#include <cstdio>
#include <cstdlib>
#include <cstring>
#define MAX 1000
char str[MAX+1];
int cnt[26];
char maxCh;
int maxCnt;
bool notPrime[MAX+1];
int main()
{
	notPrime[1]=notPrime[0]=true;
	for(int i=2;i*i<=MAX;++i)
	{
		if(!notPrime[i])
		{
			for(int j=i*i;j<=MAX;j+=2*i)
				notPrime[j]=true;
		}
	}
	while(scanf("%s",str)==1)
	{
		memset(cnt,0,sizeof(cnt));
		int len;
		for(len=0;str[len]!='\0';++len)
			cnt[str[len]-'a']++;
		maxCnt=-1;
		for(int i=0;i<26;++i)
		{
			if(maxCnt<cnt[i])
				maxCnt=cnt[i],maxCh=i+'a';
		}
		int bound=len/2;
		int same;
		if(bound>1)
			same=bound-1;
		else
			same=0;
		for(int i=bound+1;i<=len;++i)
		{
			if(notPrime[i])
				same++;
		}
		if(same>maxCnt)
			puts("NO");
		else
		{
			puts("YES");
			cnt[maxCh-'a']-=same;
			int idx=0;
			for(int i=1;i<=len;++i)
			{
				if((i>=2 && i<=bound) || (i>bound && notPrime[i]))
					str[i-1]=maxCh;
				else
				{
					while(cnt[idx]<=0)
						++idx;
					--cnt[idx];
					str[i-1]=idx+'a';
				}
			}
			puts(str);
		}
	}
}
/****** PCCA -Sat Nov 19 16:19:13 GMT 2011 *******/


#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
bool isprime(int x){
	for(int i=2;i*i<=x;i++)
		if(x%i==0)
			return false;
	return true;
}
int main(){
	int n,c[26],g[1002];
	char s[1005];
	while(scanf("%s",s)==1){
		memset(c,0,sizeof(c));
		n=strlen(s);
		for(int i=0;i<n;i++)
			c[s[i]-'a']++;
		bool ok=true;
		for(int i=2;i<=n&&ok;i++)
			if(isprime(i)){
				g[i]=-1;
				if(i>2&&i*2<=n){
					if(c[g[2]]>=(n/i+1)/2)
						g[i]=g[2];
						c[g[2]]-=(n/i+1)/2;
				}else{
					int max=0;
					for(int j=0;j<26;j++)
						if(c[j]>=max)
							max=c[j];
					for(int j=0;j<26;j++)
						if(c[j]>=n/i&&c[j]==max){
							g[i]=j;
							c[j]-=n/i;
							break;
						}
				}
				if(g[i]==-1)
					ok=false;
			}
		if(ok){
			puts("YES");
			char output[1002];
			for(int i=0;i<26;i++)
				if(c[i]>0)
					output[0]=i+'a';
			for(int i=2;i<=n;i++)
				if(isprime(i))
					for(int j=i;j<=n;j+=i)
						output[j-1]=g[i]+'a';
			output[n]=0;
			puts(output);
		}
		else puts("NO");
	}
}
/****** PCCA -Sat Nov 19 05:50:57 GMT 2011 *******/


#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

const int MAXN = 1050;
vector <int> primes;
int np[MAXN], cnt[26];
char str[MAXN], ans[MAXN];

int main()
{
    scanf("%s", str);
    int len = strlen(str);

    if(len==1)
    {
        printf("%s\n", str);
        return 0;
    }

    //primes.push_back(2);
    np[0] |= 3;
    for(int i = 2; i <= len; i++)
        if( (np[i>>5]&(1<<(i&31))) == 0 )
        {
            primes.push_back(i);
            for(int j = i<<1; j < MAXN; j+=i)
                np[j>>5] |= 1<<(j&31);
        }

    for(int i = 0; i < len; i++)
        ++cnt[ str[i] - 'a' ];

    int theMax = 0, maxc = 0;
    for(int i = 0; i < 26; i++)
        if(cnt[i] > theMax)
            theMax = cnt[i], maxc = i;

    bool failFlag = false;
    memset(ans, 0, sizeof(ans));
    for(int i = 2; i <= len; i+=2)
        if(cnt[ maxc ] > 0)
        {
            ans[i-1] = maxc+'a';
            --cnt[maxc];
        }
        else
        {
            failFlag = true;
            break;
        }

    for(int i = 1; i < primes.size() && !failFlag; i++)
    {
        int p = primes[i];

        if(primes[i]*2 <= len) //must be the same as s2, NOTICE you can only fail in this case only!
        {
            for(int i = p; i <= len; i+=p)
                if(ans[i-1]==0)
                {
                    if(cnt[ maxc ] > 0)
                    {
                        ans[i-1] = maxc+'a';
                        --cnt[maxc];
                    }
                    else
                    {
                        failFlag = true;
                        break;
                    }
                }
        }
        else //you can choose one character freely
        {
            for(int j = 0; j < 26; j++)
                if(cnt[j] > 0 && j != maxc)
                {
                    ans[p-1] = j+'a';
                    --cnt[j];
                    break;
                }

            if(ans[p-1] == 0)
            {
                ans[p-1] = maxc+'a';//no other character
                --cnt[maxc];
            }
        }
    }

    for(int i = 0; i < 26; i++) //deciding first character
        if(cnt[i] > 0)
        {
            ans[0] = i+'a';
            break;
        }

    printf("%s\n", failFlag ? "NO" : "YES");
    if(!failFlag)
    {
        for(int i = 0; i < len; i++)
            printf("%c", ans[i]);
        printf("\n");
    }

    getchar();getchar();
    return 0;
}
/****** PCCA -Sat Nov 19 04:23:16 GMT 2011 *******/


// keyword: prime
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define MAX 1000
char str[MAX+1];
int cnt[26];
char maxCh;
int maxCnt;
bool notPrime[MAX+1];
int main()
{
	notPrime[1]=notPrime[0]=true;
	for(int i=2;i*i<=MAX;++i)
	{
		if(!notPrime[i])
		{
			for(int j=i*i;j<=MAX;j+=i)
				notPrime[j]=true;
		}
	}
	while(scanf("%s",str)==1)
	{
		memset(cnt,0,sizeof(cnt));
		int len;
		for(len=0;str[len]!='\0';++len)
			cnt[str[len]-'a']++;
		maxCnt=-1;
		for(int i=0;i<26;++i)
		{
			if(maxCnt<cnt[i])
				maxCnt=cnt[i],maxCh=i+'a';
		}
		int bound=len/2;
		int same;
		if(bound>1)
			same=bound-1;
		else
			same=0;
		for(int i=bound+1;i<=len;++i)
		{
			if(notPrime[i])
				same++;
		}
		if(same>maxCnt)
			puts("NO");
		else
		{
			puts("YES");
			cnt[maxCh-'a']-=same;
			int idx=0;
			//printf("bound %d\n",bound);
			for(int i=1;i<=len;++i)
			{
				//printf("i %d notPrime %d\n",i,notPrime[i]);
				if((i>=2 && i<=bound) || (i>bound && notPrime[i]))
				{
					str[i-1]=maxCh;

				}
				else
				{
					while(cnt[idx]<=0)
						++idx;
					--cnt[idx];
					str[i-1]=idx+'a';
				}
			}
			puts(str);
		}
	}//jjjjjjjjjjjjjjjjjjjjjjjjjzj
}
/****** PCCA -Sat Nov 19 16:19:38 GMT 2011 *******/


#include <cstdio>
#include <cstdlib>
#include <cstring>
#define MAX 1000
char str[MAX+1];
int cnt[26];
char maxCh;
int maxCnt;
bool notPrime[MAX+1];
int main()
{
	notPrime[1]=notPrime[0]=true;
	for(int i=2;i*i<=MAX;++i)
	{
		if(!notPrime[i])
		{
			for(int j=i*i;j<=MAX;j+=2*i)
				notPrime[j]=true;
		}
	}
	while(scanf("%s",str)==1)
	{
		memset(cnt,0,sizeof(cnt));
		int len;
		for(len=0;str[len]!='\0';++len)
			cnt[str[len]-'a']++;
		maxCnt=-1;
		for(int i=0;i<26;++i)
		{
			if(maxCnt<cnt[i])
				maxCnt=cnt[i],maxCh=i+'a';
		}
		int bound=len/2;
		int same;
		if(bound>1)
			same=bound-1;
		else
			same=0;
		for(int i=bound+1;i<=len;++i)
		{
			if(notPrime[i])
				same++;
		}
		if(same>maxCnt)
			puts("NO");
		else
		{
			puts("YES");
			cnt[maxCh-'a']-=same;
			int idx=0;
			for(int i=1;i<=len;++i)
			{
				if((i>=2 && i<=bound) || (i>bound && notPrime[i]))
					str[i-1]=maxCh;
				else
				{
					while(cnt[idx]<=0)
						++idx;
					--cnt[idx];
					str[i-1]=idx+'a';
				}
			}
			puts(str);
		}
	}
}
/****** PCCA -Sat Nov 19 16:02:01 GMT 2011 *******/


#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

const int MAXN = 1050;
vector <int> primes;
int np[MAXN], cnt[26];
char str[MAXN], ans[MAXN];

int main()
{
    scanf("%s", str);
    int len = strlen(str);

    if(len==1)
    {
        printf("%s\n", str);
        return 0;
    }

    //primes.push_back(2);
    np[0] |= 3;
    for(int i = 2; i <= len; i++)
        if( (np[i>>5]&(1<<(i&31))) == 0 )
        {
            primes.push_back(i);
            for(int j = i<<1; j < MAXN; j+=i)
                np[j>>5] |= 1<<(j&31);
        }

    for(int i = 0; i < len; i++)
        ++cnt[ str[i] - 'a' ];

    int theMax = 0, maxc = 0;
    for(int i = 0; i < 26; i++)
        if(cnt[i] > theMax)
            theMax = cnt[i], maxc = i;

    bool failFlag = false;
    memset(ans, 0, sizeof(ans));
    for(int i = 2; i <= len; i+=2)
        if(cnt[ maxc ] > 0)
        {
            ans[i-1] = maxc+'a';
            --cnt[maxc];
        }
        else
        {
            failFlag = true;
            break;
        }

    for(int i = 1; i < primes.size() && !failFlag; i++)
    {
        int p = primes[i];

        if(primes[i]*2 < len) //must be the same as s2, NOTICE you can only fail in this case only!
        {
            for(int i = p; i <= len; i+=p)
                if(ans[i-1]==0)
                {
                    if(cnt[ maxc ] > 0)
                    {
                        ans[i-1] = maxc+'a';
                        --cnt[maxc];
                    }
                    else
                    {
                        failFlag = true;
                        break;
                    }
                }
        }
        else //you can choose one character freely
        {
            for(int j = 0; j < 26; j++)
                if(cnt[j] > 0 && j != maxc)
                {
                    ans[p-1] = j+'a';
                    --cnt[j];
                    break;
                }

            if(ans[p-1] == 0)
            {
                ans[p-1] = maxc+'a';//no other character
                --cnt[maxc];
            }
        }
    }

    for(int i = 0; i < 26; i++) //deciding first character
        if(cnt[i] > 0)
        {
            ans[0] = i+'a';
            break;
        }

    printf("%s\n", failFlag ? "NO" : "YES");
    if(!failFlag)
    {
        for(int i = 0; i < len; i++)
            printf("%c", ans[i]);
        printf("\n");
    }

    getchar();getchar();
    return 0;
}
/****** PCCA -Sat Nov 19 04:21:16 GMT 2011 *******/


#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
bool isprime(int x){
	for(int i=2;i*i<=x;i++)
		if(x%i==0)
			return false;
	return true;
}
int main(){
	int n,c[26],g[1002];
	char s[1005];
	while(scanf("%s",s)==1){
		memset(c,0,sizeof(c));
		n=strlen(s);
		for(int i=0;i<n;i++)
			c[s[i]-'a']++;
		bool ok=true;
		int used[1002]={};
		for(int i=2;i<=n&&ok;i++)
			if(isprime(i)){
				g[i]=-1;
				int count=0;
				if(i>2&&i*2<=n){
					for(int j=i;j<=n;j+=i+i)
						if(used[j]==0){
							count++;
							used[j]=1;
						}
					if(c[g[2]]>=count)
						g[i]=g[2];
						c[g[2]]-=count;
				}else{
					int max=0;
					for(int j=0;j<26;j++)
						if(c[j]>=max)
							max=c[j];
					for(int j=0;j<26;j++)
						if(c[j]>=n/i&&c[j]==max){
							g[i]=j;
							c[j]-=n/i;
							break;
						}
				}
				//printf("%d\n",c[0]);
				if(g[i]==-1)
					ok=false;
			}
		if(ok){
			puts("YES");
			char output[1002];
			for(int i=0;i<26;i++)
				if(c[i]>0)
					output[0]=i+'a';
			for(int i=2;i<=n;i++)
				if(isprime(i))
					for(int j=i;j<=n;j+=i)
						output[j-1]=g[i]+'a';
			output[n]=0;
			puts(output);
		}
		else puts("NO");
	}
}
/****** PCCA -Sat Nov 19 06:02:48 GMT 2011 *******/


#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

const int MAXN = 1050;
vector <int> primes;
int np[MAXN], cnt[26];
char str[MAXN], ans[MAXN];

int main()
{
    scanf("%s", str);
    int len = strlen(str);

    if(len==1)
    {
        printf("%s\n", str);
        return 0;
    }

    //primes.push_back(2);
    np[0] |= 3;
    for(int i = 2; i <= len; i++)
        if( (np[i>>5]&(1<<(i&31))) == 0 )
        {
            primes.push_back(i);

            for(int j = i<<1; j < MAXN; j+=i)
                np[j>>5] |= 1<<(j&31);
        }

    for(int i = 0; i < len; i++)
        ++cnt[ str[i] - 'a' ];

    int theMax = 0, maxc = 0;
    for(int i = 0; i < 26; i++)
        if(cnt[i] > theMax)
            theMax = cnt[i], maxc = i;

    bool failFlag = false;
    memset(ans, 0, sizeof(ans));
    for(int i = 2; i <= len; i+=2)
        if(cnt[ maxc ] > 0)
        {
            ans[i-1] = maxc+'a';
            --cnt[maxc];
        }
        else
        {
            failFlag = true;
            break;
        }

    for(int i = 1; i < primes.size() && !failFlag; i++)
    {
        int p = primes[i];

        if(primes[i]*2 < len) //must be the same as s2, NOTICE you can only fail in this case only!
        {
            for(int i = p; i <= len; i+=p)
                if(cnt[ maxc ] > 0)
                {
                    ans[i-1] = maxc+'a';
                    --cnt[maxc];
                }
                else
                {
                    failFlag = true;
                    break;
                }
        }
        else //you can choose one character freely
        {
            for(int j = 0; j < 26; j++)
                if(cnt[j] > 0 && j != maxc)
                {
                    ans[p-1] = j+'a';
                    --cnt[j];
                    break;
                }

            if(ans[p-1] == 0)
            {
                ans[p-1] = maxc+'a';//no other character
            }
        }
    }

    for(int i = 0; i < 26; i++) //deciding first character
        if(cnt[i] > 0)
        {
            ans[0] = i+'a';
            break;
        }

    printf("%s\n", failFlag ? "NO" : "YES");
    if(!failFlag)
    {
        for(int i = 0; i < len; i++)
            printf("%c", ans[i]);
        printf("\n");
    }

    getchar();getchar();
    return 0;
}
/****** PCCA -Sat Nov 19 04:13:26 GMT 2011 *******/


#include<cstdio>
#include<iostream>
#include<cstring>
#define MAXN 1010
using namespace std;

char s[MAXN];
int N;
int num[30];
int prime[MAXN],cnt[MAXN],p;

bool isprime(int k)
{
    for(int i=2;i<k;i++)
    {
        if(k%i==0)
        {
            return false;
        }
    }
    return true;
}
char nextnum()
{
    for(int i=0;i<26;i++)
    {
        if(num[i])
        {
            num[i]--;
            return i+'a';
        }
    }
}

int main()
{
    for(int i=2;i<N;i++)
    {
        if(isprime(i))
        {
            prime[p++]=i;
        }
    }

    gets(s);
    N=strlen(s);

    for(int i=0;i<N;i++)
    {
        num[s[i]-'a']++;
    }
    for(int i=0;i<p;i++)
    {
        cnt[i]=N/prime[i];
    }
    int i;
    for(i=1;i<p&&2*prime[i]<=N;i++)
    {
        cnt[0]+=cnt[i];
    }
    memset(s,0,sizeof(s));

    for(int k=0;k<='z'-'a';k++)
    {
        if(num[k]>=cnt[0])
        {
            cout<<"YES"<<endl;
            for(int j=0;j<i;j++)
            {
                for(int tmp=prime[j];tmp<=N;tmp+=prime[j])
                {
                    if(s[tmp]==0)
                    {
                        s[tmp]=k+'a';
                        num[k]--;
                    }
                }
            }
            for(int l=1;l<=N;l++)
            {
                if(s[l]==0)
                {
                    s[l]=nextnum();
                }
            }
            s[N+1]=0;
            puts(s+1);
            return 0;
        }
    }
    puts("NO");
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#define MAXN 1010
using namespace std;

char s[MAXN];
int N;
int num[30];
int prime[MAXN],cnt[MAXN],p;

bool isprime(int k)
{
    for(int i=2;i<k;i++)
    {
        if(k%i==0)
        {
            return false;
        }
    }
    return true;
}
char nextnum()
{
    for(int i=0;i<26;i++)
    {
        if(num[i])
        {
            num[i]--;
            return i+'a';
        }
    }
}

int main()
{
    for(int i=2;i<MAXN;i++)
    {
        if(isprime(i))
        {
            prime[p++]=i;
        }
    }

    gets(s);
    N=strlen(s);

    for(int i=0;i<N;i++)
    {
        num[s[i]-'a']++;
    }
    for(int i=0;i<p;i++)
    {
        cnt[i]=N/prime[i];
    }
    int i;
    for(i=1;i<p&&2*prime[i]<=N;i++)
    {
        cnt[0]+=cnt[i];
    }
    memset(s,0,sizeof(s));

    for(int k=0;k<='z'-'a';k++)
    {
        if(num[k]>=cnt[0])
        {
            cout<<"YES"<<endl;
            for(int j=0;j<i;j++)
            {
                for(int tmp=prime[j];tmp<=N;tmp+=prime[j])
                {
                    if(s[tmp]==0)
                    {
                        s[tmp]=k+'a';
                        num[k]--;
                    }
                }
            }
            for(int l=1;l<=N;l++)
            {
                if(s[l]==0)
                {
                    s[l]=nextnum();
                }
            }
            s[N+1]=0;
            puts(s+1);
            return 0;
        }
    }
    puts("NO");
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#define MAXN 1010
using namespace std;

char s[MAXN];
int N;
int num[30];
int prime[MAXN],cnt[MAXN],p;
int inf;

bool isprime(int k)
{
    for(int i=2;i<k;i++)
    {
        if(k%i==0)
        {
            return false;
        }
    }
    return true;
}
char nextnum()
{
    for(int i=0;i<26;i++)
    {
        if(num[i])
        {
            num[i]--;
            return i+'a';
        }
    }
}

int main()
{

    gets(s);
    N=strlen(s);

    for(int i=2;i<=MAXN;i++)
    {
        if(isprime(i))
        {
            prime[p++]=i;
        }
    }

    for(int i=0;i<N;i++)
    {
        num[s[i]-'a']++;
    }
    for(int i=0;i<p;i++)
    {
        cnt[i]=N/prime[i];
    }
    int i;
    for(i=0;i<p&&2*prime[i]<=N;i++);
    for(int j=1;j<=N;j++)
    {
        for(int k=0;k<i;k++)
        {
            if(j%prime[k]==0)
            {
                inf++;
                break;
            }
        }
    }
    memset(s,0,sizeof(s));

    for(int k=0;k<='z'-'a';k++)
    {
        if(num[k]>=inf)
        {
            cout<<"YES"<<endl;
            for(int j=0;2*prime[j]<=N;j++)
            {
                for(int tmp=prime[j];tmp<=N;tmp+=prime[j])
                {
                    if(s[tmp]==0)
                    {
                        s[tmp]=k+'a';
                        num[k]--;
                    }
                }
            }
            for(int l=1;l<=N;l++)
            {
                if(s[l]==0)
                {
                    s[l]=nextnum();
                }
            }
            s[N+1]=0;
            puts(s+1);
            return 0;
        }
    }
    puts("NO");
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#define MAXN 1010
using namespace std;

char s[MAXN];
int N;
int num[30];
int prime[MAXN],cnt[MAXN],p;

bool isprime(int k)
{
    for(int i=2;i<k;i++)
    {
        if(k%i==0)
        {
            return false;
        }
    }
    return true;
}
char nextnum()
{
    for(int i=0;i<26;i++)
    {
        if(num[i])
        {
            num[i]--;
            return i+'a';
        }
    }
}

int main()
{

    gets(s);
    N=strlen(s);

    for(int i=2;i<=N;i++)
    {
        if(isprime(i))
        {
            prime[p++]=i;
        }
    }

    for(int i=0;i<N;i++)
    {
        num[s[i]-'a']++;
    }
    for(int i=0;i<p;i++)
    {
        cnt[i]=N/prime[i];
    }
    int i;
    for(i=1;i<p&&2*prime[i]<=N;i++)
    {
        cnt[0]+=cnt[i];
    }
    memset(s,0,sizeof(s));

    for(int k=0;k<='z'-'a';k++)
    {
        if(num[k]>=cnt[0])
        {
            cout<<"YES"<<endl;
            for(int j=0;j<i;j++)
            {
                for(int tmp=prime[j];tmp<=N;tmp+=prime[j])
                {
                    if(s[tmp]==0)
                    {
                        s[tmp]=k+'a';
                        num[k]--;
                    }
                }
            }
            for(int l=1;l<=N;l++)
            {
                if(s[l]==0)
                {
                    s[l]=nextnum();
                }
            }
            s[N+1]=0;
            puts(s+1);
            return 0;
        }
    }
    puts("NO");
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

const int N = 1010;
const int oo = 2147483647;

string in;
int ele[N],root[N];
vector < int > prime;
vector < pair<int ,char> > cntstr;
vector < pair<int, int> >need;

int findroot(int x)
{
    return root[x] = (root[x] == x ? x : findroot(root[x]));
}

void init(int n)
{
    prime.clear();
    cntstr.clear();
    need.clear();
    memset(ele,0,sizeof(ele));
    for(int i = 1; i <= n ; i++)
        root[i] = i;
    for(int i = 2; i <= n; i++)
    {
        bool judge = true;
        for(int j = 2; j * j <= i; j++)
        {
            if(i % j == 0)
            {
                judge = false;
                break;
            }
        }
        if(judge)
        {
            prime.push_back(i);
            for(int j = 1; j * i <= n; j++)
            {
                int a = findroot(i) , b = findroot(j * i);
                root[a] = b;
            }
        }
    }
}

int main()
{
    while(cin >> in)
    {
        string ans = in;
        int n = in.size();
        init(n);
        for(char ch = 'a' ; ch <= 'z'; ch++)
        {
            int cnt = count(in.begin(), in.end(), ch);
            cntstr.push_back(make_pair(cnt, ch));
        }
        for(int i = 1; i <= n; i++)
        {
            ele[findroot(i)]++;
        }
        for(int i = 1; i <= n ; i++)
        {
            if(ele[i] > 0)
                need.push_back(make_pair(ele[i], i));
        }
        sort(need.rbegin(), need.rend());
        bool judge = true;
        for(int i = 0; i < (int) need.size(); i++)
        {
            sort(cntstr.rbegin(), cntstr.rend());
            if(cntstr[0].first < need[i].first )
            {
                judge = false;
                break;
            }
            cntstr[0].first -= need[i].first;
            for(int j = 1; j <= n; j++)
            {
                if(findroot(j) == need[i].second)
                {
                    ans[j - 1] = cntstr[0].second;
                }
            }
        }
        if(judge)
        {
            cout << "YES" << endl;
            cout << ans << endl;
        }
        else
            cout << "NO" << endl;
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

const int N = 100;
const int oo = 2147483647;

string in;
int cnt[N];
vector < int > prime;
bool has[N * 11];

void getprime(int n)
{
    prime.clear();
    for(int i = 2; i <= n; i++)
    {
        bool judge = true;
        for(int j = 2; j * j <= i; j++)
        {
            if(i % j == 0)
            {
                judge = false;
                break;
            }
        }
        if(judge)
            prime.push_back(i);
    }
}

void init(int n)
{
    memset(cnt,0,sizeof(cnt));
    memset(has,false,sizeof(has));
    getprime(n);
}

int main()
{
    while(cin >> in)
    {
        int s = in.size();
        if(s == 1)
        {
            cout << "YES" << endl;
            cout << in << endl;
            continue;
        }
        init(s);
        string ans = in;
        for(int i = 1 ; i < s; i++)
        {
            cnt[in[i] - 'a']++;
        }
        bool judge = true;
        for(int i = 0 ;  i < (int) prime.size(); i++)
        {
            int tmp = s / prime[i], cnttmp = 0;
            for(int j = 1; j <= tmp; j++)
                if(!has[j * prime[i]])
                    cnttmp++;
            bool tag = false;
            for(int j = 0 ; j < 26; j++)
            {
                if(cnt[j] >= cnttmp)
                {
                    cnt[j] -= cnttmp;
                    for(int k = 1; k <= tmp; k++)
                    {
                        if(!has[k * prime[i]])
                        {
                            ans[k * prime[i] - 1] = j + 'a';
                            has[k * prime[i]] = true;
                        }
                    }
                    tag = true;
                    break;
                }
            }
            if(!tag)
            {
                judge = false;
                break;
            }
        }
        if(judge)
        {
            cout << "YES" << endl;
            cout << ans << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

const int N = 100;
const int oo = 2147483647;

string in;
int cnt[N];
vector < int > prime;
bool has[N * 11];

void getprime(int n)
{
    prime.clear();
    for(int i = 2; i <= n; i++)
    {
        bool judge = true;
        for(int j = 2; j * j <= i; j++)
        {
            if(i % j == 0)
            {
                judge = false;
                break;
            }
        }
        if(judge)
            prime.push_back(i);
    }
}

void init(int n)
{
    memset(cnt,0,sizeof(cnt));
    memset(has,false,sizeof(has));
    getprime(n);
}

int main()
{
    while(cin >> in)
    {
        int s = in.size();
        if(s == 1)
        {
            cout << "YES" << endl;
            cout << in << endl;
            continue;
        }
        init(s);
        string ans = in;
        for(int i = 1 ; i < s; i++)
        {
            cnt[in[i] - 'a']++;
        }
        bool judge = true;
        for(int i = 0 ;  i < (int) prime.size(); i++)
        {
            int tmp = s / prime[i], cnttmp = 0;
            for(int j = 1; j <= tmp; j++)
                if(!has[j * prime[i]])
                    cnttmp++;
            bool tag = false;
            for(int j = 0 ; j < 26; j++)
            {
                if(cnt[j] >= cnttmp)
                {
                    cnt[j] -= cnttmp;
                    for(int k = 1; k <= tmp; k++)
                    {
                        if(!has[k * prime[i]])
                        {
                            ans[k * prime[i] - 1] = j + 'a';
                            has[k * prime[i]] = true;
                        }
                        else
                        {
                            if(ans[k * prime[i] - 1] != j + 'a')
                            {
                                tag = false;
                                break;
                            }
                        }
                    }
                    tag = true;
                    break;
                }
            }
            if(!tag)
            {
                judge = false;
                break;
            }
        }
        if(judge)
        {
            cout << "YES" << endl;
            cout << ans << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#include <numeric>
#include <ctime>
using namespace std;

int LCM(int a, int b)
{
	return 0;
}

int main()
{
	string s; int letter[30]; int arr[1010]; int inc[1010]; cin >> s;
	memset(letter, 0, sizeof letter); for(int i = 0; i < s.size(); ++i) ++letter[s[i] - 'a'];
	string ans = "";
	for(int i = 0; i < s.size(); ++i) ans += '0';
	memset(arr, 0, sizeof arr);
	bool b = 1;
	for(int i = 2; i <= s.size(); ++i)
	{
		int* c = max_element(letter, letter + 26);
		int* m = c;
		if(arr[i]) continue;
		for(int j = i; j <= s.size(); j += i)
		{
			if (ans[j - 1] != '0')
			{
				m = letter + ans[j - 1] - 'a';
				break;
			}
			arr[j] = 1;
		}
		for(int j = i; j <= s.size(); j += i)
		{
			if(*m == 0) { b = 0; break; }
			if(ans[j - 1] == '0')
			{	ans[j - 1] = m - letter + 'a';
				(*m)--;
			}
		}
		if(!b) break;
	}
	for(int  i = 0; i < s.size(); ++i)
	{
		int* c = max_element(letter, letter + 26);
		if(ans[i] == '0')
		{
			ans[i] = c - letter + 'a';
			--(*c);
		}
	}
	if(b) cout << "YES" << endl << ans << endl;
	else cout << "NO" << endl;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#include <numeric>
#include <ctime>
using namespace std;

int LCM(int a, int b)
{
	return 0;
}

int main()
{
	string s; int letter[30]; int arr[1010]; int inc[1010]; cin >> s;
	memset(letter, 0, sizeof letter); for(int i = 0; i < s.size(); ++i) ++letter[s[i] - 'a'];
	string ans = "";
	for(int i = 0; i < s.size(); ++i) ans += '0';
	memset(arr, 0, sizeof arr);
	bool b = 1;
	for(int i = 2; i <= s.size(); ++i)
	{
		int* c = max_element(letter, letter + 26);
		int* m = c;
		if(arr[i]) continue;
		for(int j = i; j <= s.size(); j += i)
		{
			if (ans[j - 1] != '0')
			{
				m = letter + ans[j - 1] - 'a';
				break;
			}
			arr[j] = 1;
		}
		for(int j = i; j <= s.size(); j += i)
		{
			if(ans[j - 1] == '0' && *m == 0) { b = 0; break; }
			if(ans[j - 1] == '0')
			{	ans[j - 1] = m - letter + 'a';
				(*m)--;
			}
			arr[j] = 1;
		}
		if(!b) break;
	}
	for(int  i = 0; i < s.size(); ++i)
	{
		int* c = max_element(letter, letter + 26);
		if(ans[i] == '0')
		{
			ans[i] = c - letter + 'a';
			--(*c);
		}
	}
	if(b) cout << "YES" << endl << ans << endl;
	else cout << "NO" << endl;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#include <numeric>
#include <ctime>
using namespace std;

int LCM(int a, int b)
{
	return 0;
}

int main()
{
	string s; int letter[30]; int arr[1010]; int inc[1010]; cin >> s;
	memset(letter, 0, sizeof letter); for(int i = 0; i < s.size(); ++i) ++letter[s[i] - 'a'];
	string ans = "";
	for(int i = 0; i < s.size(); ++i) ans += '0';
	memset(arr, 0, sizeof arr);
	bool b = 1;
	for(int i = 2; i <= s.size(); ++i)
	{
		int* c = max_element(letter, letter + 26);
		int* m = c;
		if(arr[i]) continue;
		for(int j = i; j <= s.size(); j += i)
		{
			if (ans[j - 1] != '0')
			{
				m = letter + ans[j - 1] - 'a';
				break;
			}
			arr[j] = 1;
		}
		for(int j = i; j <= s.size(); j += i)
		{
			if(*m == 0) { b = 0; break; }
			if(ans[j - 1] == '0')
			{	ans[j - 1] = m - letter + 'a';
				(*m)--;
			}
			arr[j] = 1;
		}
		if(!b) break;
	}
	for(int  i = 0; i < s.size(); ++i)
	{
		int* c = max_element(letter, letter + 26);
		if(ans[i] == '0')
		{
			ans[i] = c - letter + 'a';
			--(*c);
		}
	}
	if(b) cout << "YES" << endl << ans << endl;
	else cout << "NO" << endl;
}


#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <list>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;
typedef long long          ll;
typedef long double        ld;
typedef pair<int,int>      pii;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;
typedef vector<long long>  vll;
#define mp                 make_pair
#define pb                 push_back
#define all(a)             a.begin(),a.end()
#define sor(a)             sort(all(a));
#define rsor(a)            sor(a) reverse(all(a));
#define pr(n)              printf("%d ",n)
#define s(n)               scanf("%d",&n)
#define debug(a)           std::cerr<<#a<<"="<<(a)<<"\n"
#define ss                 second
#define ff                 first
#define m0(x) 		   memset(x,0,sizeof(x))
#define snuke(c,itr)       for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
const int mod=1e9+7;
const long double PI = (long double)(3.1415926535897932384626433832795);

inline bool ispow2(int x){return (x!=0 && (x&(x-1))==0);} //0 or 1

template<class T>
inline void cinarr(T a, int n){ for (int i=0;i<n;++i) cin >> a[i];}

inline ll powmod(ll a,ll b) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}

int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

inline ll gcd(ll a,ll b){ll t;while(b){a=a%b;t=a;a=b;b=t;}return a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);

    string s; cin>>s;

    int len = s.length();

    int cnt[257] = {0};
    for(int i=0;i<len; i++)
    {
        cnt[s[i]-'0']++;
    }

    int mx=-1;
    char mx_ch;
    for(int i=0;i<len;i++)
    {
        if(cnt[s[i]-'0'] > mx )
        {
            mx = cnt[s[i]-'0'];
            mx_ch =s[i];
        }
    }

    int isprime[len+2];
    memset(isprime,1,sizeof(isprime));

    isprime[0]=0;
    isprime[1]=0;
    for(int i=2;i<=len+10;i++)
    {
        if(isprime[i])
        {
            for(int j=i*i;j<len+10;j+=i)
            {
                isprime[j]=0;
            }
        }
    }

    int id=len/2 - 1 ;
    for(int i=len/2 +1 ; i<= len; i++)
    {
        if(!isprime[i])
        {
            id++;
        }
    }

    if(mx < id )
    {
        cout<<"NO"<<"\n";
    }
    else
    {

        string res(len,'*');

        bool vis[len+1];
        memset(vis,false,sizeof(vis));

        int dn=0;
        for(int i=1;i<=len;i++)
        {
            if(i!=1 && i <= len/2)
            {
                vis[i] =true;
                dn++;
            }
            else if( i>= len/2 +1 && !isprime[i] )
            {
                vis[i] =true;
                dn++;
            }
        }
        for(int i=1;i<=len;i++)
        {
            if(vis[i])
            {
                res[i-1] = mx_ch;
            }
        }

        cnt[mx_ch-'0'] -= dn;
        for(int i=1;i<=len;i++)
        {
            if(!vis[i])
            {
                for(char j = 'a'; j<='z';j++)
                {
                    if(cnt[j-'0'])
                    {
                        res[i-1] = char(j);
                        cnt[j-'0']--;
                        break;
                    }
                }
            }
        }
        cout<<"YES\n"<<res<<"\n";
    }
    return 0;
}


#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <list>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;
typedef long long          ll;
typedef long double        ld;
typedef pair<int,int>      pii;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;
typedef vector<long long>  vll;
#define mp                 make_pair
#define pb                 push_back
#define all(a)             a.begin(),a.end()
#define sor(a)             sort(all(a));
#define rsor(a)            sor(a) reverse(all(a));
#define pr(n)              printf("%d ",n)
#define s(n)               scanf("%d",&n)
#define debug(a)           std::cerr<<#a<<"="<<(a)<<"\n"
#define ss                 second
#define ff                 first
#define m0(x) 		   memset(x,0,sizeof(x))
#define snuke(c,itr)       for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
const int mod=1e9+7;
const long double PI = (long double)(3.1415926535897932384626433832795);

inline bool ispow2(int x){return (x!=0 && (x&(x-1))==0);} //0 or 1

template<class T>
inline void cinarr(T a, int n){ for (int i=0;i<n;++i) cin >> a[i];}

inline ll powmod(ll a,ll b) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}

int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

inline ll gcd(ll a,ll b){ll t;while(b){a=a%b;t=a;a=b;b=t;}return a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);

    string s; cin>>s;

    int len = s.length();

    int cnt[257] = {0};
    for(int i=0;i<len; i++)
    {
        cnt[s[i]-'0']++;
    }

    int mx=-1;
    char mx_ch;
    for(int i=0;i<len;i++)
    {
        if(cnt[s[i]-'0'] > mx )
        {
            mx = cnt[s[i]-'0'];
            mx_ch =s[i];
        }
    }

    //now count the positions in which this max_ch will be stored

    int isprime[len+2];
    memset(isprime,1,sizeof(isprime));

    isprime[0]=0;
    isprime[1]=0;
    // 1 2 3 ... len
    for(int i=2;i<=len+10;i++)
    {
        if(isprime[i])
        {
            for(int j=i*i;j<len+10;j+=i)
            {
                isprime[j]=0;
            }
        }
    }
    // except 1 and prime > len/2 all shoul be same characters

    int id=len/2 ;
    for(int i=len/2 +1 ; i<= len; i++)
    {
        if(!isprime[i])
        {
            id++;
        }
    }

    // we need id number of char's to be same

    if(mx < id )
    {
        cout<<"NO"<<"\n";
    }
    else
    {

        string res(len,'*');

        bool vis[len+1];
        memset(vis,false,sizeof(vis));

        int dn=0;
        for(int i=1;i<=len;i++)
        {
            if(i!=1 && i <= len/2)
            {
                vis[i] =true;
                dn++;
            }
            else if( i>= len/2 +1 && !isprime[i] )
            {
                vis[i] =true;
                dn++;
            }
        }
        for(int i=1;i<=len;i++)
        {
            if(vis[i])
            {
                res[i-1] = mx_ch;
            }
        }

        cnt[mx_ch-'0'] -= dn;
        for(int i=1;i<=len;i++)
        {
            if(!vis[i])
            {
                for(char j = 'a'; j<='z';j++)
                {
                    if(cnt[j-'0'])
                    {
                        res[i-1] = char(j);
                        cnt[j-'0']--;
                        break;
                    }
                }
            }
        }
        cout<<"YES\n"<<res<<"\n";
    }
    return 0;
}


#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <list>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;
typedef long long          ll;
typedef long double        ld;
typedef pair<int,int>      pii;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;
typedef vector<long long>  vll;
#define mp                 make_pair
#define pb                 push_back
#define all(a)             a.begin(),a.end()
#define sor(a)             sort(all(a));
#define rsor(a)            sor(a) reverse(all(a));
#define pr(n)              printf("%d ",n)
#define s(n)               scanf("%d",&n)
#define debug(a)           std::cerr<<#a<<"="<<(a)<<"\n"
#define ss                 second
#define ff                 first
#define m0(x) 		   memset(x,0,sizeof(x))
#define snuke(c,itr)       for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
const int mod=1e9+7;
const long double PI = (long double)(3.1415926535897932384626433832795);

inline bool ispow2(int x){return (x!=0 && (x&(x-1))==0);} //0 or 1

template<class T>
inline void cinarr(T a, int n){ for (int i=0;i<n;++i) cin >> a[i];}

inline ll powmod(ll a,ll b) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}

int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

inline ll gcd(ll a,ll b){ll t;while(b){a=a%b;t=a;a=b;b=t;}return a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);

    string s; cin>>s;

    int len = s.length();

    int cnt[257] = {0};
    for(int i=0;i<len; i++)
    {
        cnt[s[i]-'0']++;
    }

    int mx=-1;
    char mx_ch;
    for(int i=0;i<len;i++)
    {
        if(cnt[s[i]-'0'] > mx )
        {
            mx = cnt[s[i]-'0'];
            mx_ch =s[i];
        }
    }

    //now count the positions in which this max_ch will be stored

    int isprime[len+2];
    memset(isprime,1,sizeof(isprime));

    isprime[0]=0;
    isprime[1]=0;
    // 1 2 3 ... len
    for(int i=2;i<=len;i++)
    {
        if(isprime[i])
        {
            for(int j=i*i;j<len;j+=i)
            {
                isprime[j]=0;
            }
        }
    }
    int id=len/2 ;
    for(int i=len/2 +1 ; i<= len; i++)
    {
        if(!isprime[i])
        {
            id++;
        }
    }
    if(mx < id )
    {
        cout<<"NO"<<"\n";
    }
    else
    {

        string res(len,'*');

        bool vis[len+1];
        memset(vis,false,sizeof(vis));

        int dn=0;
        for(int i=1;i<=len;i++)
        {
            if(i!=1 && i <= len/2)
            {
                vis[i] =true;
                dn++;
            }
            else if( i>= len/2 +1 && !isprime[i] )
            {
                vis[i] =true;
                dn++;
            }
        }
        for(int i=1;i<=len;i++)
        {
            if(vis[i])
            {
                res[i-1] = mx_ch;
            }
        }

        cnt[mx_ch-'0'] -= dn;
        for(int i=1;i<=len;i++)
        {
            if(!vis[i])
            {
                for(char j = 'a'; j<='z';j++)
                {
                    if(cnt[j-'0'])
                    {
                        res[i-1] = char(j);
                        cnt[j-'0']--;
                        break;
                    }
                }
            }
        }
        cout<<"YES\n"<<res<<"\n";
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

bool is_prime(int p){
	for(int i = 2; i*i <= p; i++)
		if(p % i == 0) return false;
	return true;
}

int places[1024], count[256];
char res[1024], chars[1024], str[1024];

int main(){
#ifdef JUAMPI
	freopen("primeperm.in","r",stdin);
#endif

	gets(str);
	int n = strlen(str);

	char max = '_'; int max_app = 0;

	memset(count,0,sizeof(count));

	for(int i = 0; i < n; i++) count[(int) str[i]]++;
	for(int i = 0; i < n; i++)
		if(count[(int) str[i]] > max_app){
			max_app = count[(int) str[i]],
			max = str[i];
		}

	int total = 0;
	for(int i = 0; i < n; i++)
		if(2*(i+1) <= n || !is_prime(i+1)) total++;

	if(max_app < total-1){
		printf("NO\n");
	}else{
		printf("YES\n");

		for(int i = 0; i <= n; i++) res[i] = '\0';
		for(int i = 0; i < n; i++)
			if(i != 0 && ((i+1) % 2 == 0 || !(2*(i+1) > n && is_prime(i+1)))){ res[i] = max; max_app--; }

		for(int i = 0; i < n; i++)
			if(res[i] == '\0'){
				if(max_app > 0){
					res[i] = max; max_app--;
				}else{
					for(int j = 0; j < n; j++)
						if(str[j] != max){
							res[i] = str[j];
							str[j] = max;
							break;
						}
				}
			}

		printf("%s\n",res);
		for(int i = 0; i < n; i++) cerr << i+1 << " : " << res[i] << endl;
	}

	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

bool is_prime(int p){
	for(int i = 2; i*i <= p; i++)
		if(p % i == 0) return false;
	return true;
}

int places[1024], count[256];
char res[1024], chars[1024], str[1024];

int main(){
#ifdef JUAMPI
	freopen("primeperm.in","r",stdin);
#endif

	gets(str);
	int n = strlen(str);

	char max = '_'; int max_app = 0;

	memset(count,0,sizeof(count));

	for(int i = 0; i < n; i++) count[(int) str[i]]++;
	for(int i = 0; i < n; i++)
		if(count[(int) str[i]] > max_app){
			max_app = count[(int) str[i]],
			max = str[i];
		}

	int total = 0;
	for(int i = 0; i < n; i++)
		if((i+1) <= n/2 || !is_prime(i+1)) total++;

	if(max_app < total){
		printf("NO\n");
	}else{
		printf("YES\n");

		for(int i = 0; i <= n; i++) res[i] = '\0';
		for(int i = 0; i < n; i++)
			if((i+1) % 2 == 0){ res[i] = max; max_app--; }

		for(int i = 0; i < n; i++)
			if(res[i] == 0){
				if(max_app > 0){
					res[i] = max; max_app--;
				}else{
					for(int j = 0; j < n; j++)
						if(str[j] != max){
							res[i] = str[j];
							str[j] = max;
							break;
						}
				}
			}

		printf("%s\n",res);
	}

	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

bool is_prime(int p){
	for(int i = 2; i*i <= p; i++)
		if(p % i == 0) return false;
	return true;
}

int places[1024], count[256];
char res[1024], chars[1024], str[1024];

int main(){
#ifdef JUAMPI
	freopen("primeperm.in","r",stdin);
#endif

	gets(str);
	int n = strlen(str);

	char max = '_'; int max_app = 0;

	memset(count,0,sizeof(count));

	for(int i = 0; i < n; i++) count[(int) str[i]]++;
	for(int i = 0; i < n; i++)
		if(count[(int) str[i]] > max_app){
			max_app = count[(int) str[i]],
			max = str[i];
		}

	int total = 0;
	for(int i = 0; i < n; i++)
		if((i+1) < n/2 || !is_prime(i+1)) total++;

	if(max_app < total){
		printf("NO\n");
	}else{
		printf("YES\n");

		for(int i = 0; i <= n; i++) res[i] = '\0';
		for(int i = 0; i < n; i++)
			if((i+1) % 2 == 0 || !is_prime(i+1)){ res[i] = max; max_app--; }

		for(int i = 0; i < n; i++)
			if(res[i] == '\0'){
				if(max_app > 0){
					res[i] = max; max_app--;
				}else{
					for(int j = 0; j < n; j++)
						if(str[j] != max){
							res[i] = str[j];
							str[j] = max;
							break;
						}
				}
			}

		printf("%s\n",res);
	}

	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

bool is_prime(int p){
	for(int i = 2; i*i <= p; i++)
		if(p % i == 0) return false;
	return true;
}

int places[1024], count[256];
char res[1024], chars[1024], str[1024];

int main(){
#ifdef JUAMPI
	freopen("primeperm.in","r",stdin);
#endif

	gets(str);
	int n = strlen(str);

	char max = '_'; int max_app = 0;

	memset(count,0,sizeof(count));

	for(int i = 0; i < n; i++) count[(int) str[i]]++;
	for(int i = 0; i < n; i++)
		if(count[(int) str[i]] > max_app){
			max_app = count[(int) str[i]],
			max = str[i];
		}

	int total = 0;
	for(int i = 0; i < n; i++)
		if((i+1) < n/2 || !is_prime(i+1)) total++;

	if(max_app < total){
		printf("NO\n");
	}else{
		printf("YES\n");

		for(int i = 0; i <= n; i++) res[i] = '\0';
		for(int i = 0; i < n; i++)
			if((i+1) % 2 == 0 || !(i+1 >= n/2 && is_prime(i+1))){ res[i] = max; max_app--; }

		for(int i = 0; i < n; i++)
			if(res[i] == '\0'){
				if(max_app > 0){
					res[i] = max; max_app--;
				}else{
					for(int j = 0; j < n; j++)
						if(str[j] != max){
							res[i] = str[j];
							str[j] = max;
							break;
						}
				}
			}

		printf("%s\n",res);
	}

	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

bool is_prime(int p){
	for(int i = 2; i*i <= p; i++)
		if(p % i == 0) return false;
	return true;
}

int places[1024], count[256];
char res[1024], chars[1024], str[1024];

int main(){
#ifdef JUAMPI
	freopen("primeperm.in","r",stdin);
#endif

	gets(str);
	int n = strlen(str);

	char max = '_'; int max_app = 0;

	memset(count,0,sizeof(count));

	for(int i = 0; i < n; i++) count[(int) str[i]]++;
	for(int i = 0; i < n; i++)
		if(count[(int) str[i]] > max_app){
			max_app = count[(int) str[i]],
			max = str[i];
		}

	int total = 0;
	for(int i = 0; i < n; i++)
		if((i+1) < n/2 || !is_prime(i+1)) total++;

	if(max_app < total){
		printf("NO\n");
	}else{
		printf("YES\n");

		for(int i = 0; i <= n; i++) res[i] = '\0';
		for(int i = 0; i < n; i++)
			if((i+1) % 2 == 0 || i <= n/2 || !is_prime(i+1)){ res[i] = max; max_app--; }

		for(int i = 0; i < n; i++)
			if(res[i] == '\0'){
				if(max_app > 0){
					res[i] = max; max_app--;
				}else{
					for(int j = 0; j < n; j++)
						if(str[j] != max){
							res[i] = str[j];
							str[j] = max;
							break;
						}
				}
			}

		printf("%s\n",res);
	}

	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

bool is_prime(int p){
	for(int i = 2; i*i <= p; i++)
		if(p % i == 0) return false;
	return true;
}

int places[1024], count[256];
char res[1024], chars[1024], str[1024];

int main(){
#ifdef JUAMPI
	freopen("primeperm.in","r",stdin);
#endif

	gets(str);
	int n = strlen(str);

	char max = '_'; int max_app = 0;

	memset(count,0,sizeof(count));

	for(int i = 0; i < n; i++) count[(int) str[i]]++;
	for(int i = 0; i < n; i++)
		if(count[(int) str[i]] > max_app){
			max_app = count[(int) str[i]],
			max = str[i];
		}

	int total = 0;
	for(int i = 0; i < n; i++)
		if((i+1) <= n/2 || !is_prime(i+1)) total++;

	if(max_app < total){
		printf("NO\n");
	}else{
		printf("YES\n");

		for(int i = 0; i <= n; i++) res[i] = '\0';
		for(int i = 0; i < n; i++)
			if((i+1) % 2 == 0 || !is_prime(i+1)){ res[i] = max; max_app--; }

		for(int i = 0; i < n; i++)
			if(res[i] == '\0'){
				if(max_app > 0){
					res[i] = max; max_app--;
				}else{
					for(int j = 0; j < n; j++)
						if(str[j] != max){
							res[i] = str[j];
							str[j] = max;
							break;
						}
				}
			}

		printf("%s\n",res);
	}

	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

bool is_prime(int p){
	for(int i = 2; i*i <= p; i++)
		if(p % i == 0) return false;
	return true;
}

int places[1024], count[256];
char res[1024], chars[1024], str[1024];

int main(){
#ifdef JUAMPI
	freopen("primeperm.in","r",stdin);
#endif

	gets(str);
	int n = strlen(str);

	char max = '_'; int max_app = 0;

	memset(count,0,sizeof(count));

	for(int i = 0; i < n; i++) count[(int) str[i]]++;
	for(int i = 0; i < n; i++)
		if(count[(int) str[i]] > max_app){
			max_app = count[(int) str[i]],
			max = str[i];
		}

	int total = 0;
	for(int i = 0; i < n; i++)
		if((i+1) < n/2 || !is_prime(i+1)) total++;

	if(max_app < total){
		printf("NO\n");
	}else{
		printf("YES\n");

		for(int i = 0; i <= n; i++) res[i] = '\0';
		for(int i = 0; i < n; i++)
			if((i+1) % 2 == 0 || i+1 < n/2 || !is_prime(i+1)){ res[i] = max; max_app--; }

		for(int i = 0; i < n; i++)
			if(res[i] == '\0'){
				if(max_app > 0){
					res[i] = max; max_app--;
				}else{
					for(int j = 0; j < n; j++)
						if(str[j] != max){
							res[i] = str[j];
							str[j] = max;
							break;
						}
				}
			}

		printf("%s\n",res);
	}

	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

bool is_prime(int p){
	for(int i = 2; i*i <= p; i++)
		if(p % i == 0) return false;
	return true;
}

int places[1024], count[256];
char res[1024], chars[1024], str[1024];

int main(){
#ifdef JUAMPI
	freopen("primeperm.in","r",stdin);
#endif

	gets(str);
	int n = strlen(str);

	char max = '_'; int max_app = 0;

	memset(count,0,sizeof(count));

	for(int i = 0; i < n; i++) count[(int) str[i]]++;
	for(int i = 0; i < n; i++)
		if(count[(int) str[i]] > max_app){
			max_app = count[(int) str[i]],
			max = str[i];
		}

	int total = 0;
	for(int i = 0; i < n; i++)
		if((i+1) < n/2 || !is_prime(i+1)) total++;

	if(max_app < total){
		printf("NO\n");
	}else{
		printf("YES\n");

		for(int i = 0; i <= n; i++) res[i] = '\0';
		for(int i = 0; i < n; i++)
			if((i+1) % 2 == 0 || 2*(i+1) == n || !is_prime(i+1)){ res[i] = max; max_app--; }

		for(int i = 0; i < n; i++)
			if(res[i] == '\0'){
				if(max_app > 0){
					res[i] = max; max_app--;
				}else{
					for(int j = 0; j < n; j++)
						if(str[j] != max){
							res[i] = str[j];
							str[j] = max;
							break;
						}
				}
			}

		printf("%s\n",res);
	}

	return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[26];
bool isprime[1000];
int main() {
	memset(isprime,1, sizeof isprime);
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    memset(a,0,sizeof a);
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++)
		a[s[i]-'a']++;
	vector<pair<int,char> > p;
	for(int i=0;i<26;i++)
		p.push_back(make_pair(a[i],'a'+i));
	int n=s.length();
	int k;
	bool ans=true;
	for(int i=2;i<=n;i++)
	{
		if(isprime[i])
		{
			k=1;
			for(int j=i*i;j<=n;j+=i)
			{
				if(isprime[j])
					{
						isprime[j]=false;
						k++;
					}
			}
			sort(p.begin(), p.end());
			if(p[25].first>=k)
			{
				s[i-1]=p[25].second;
				for(int j=i*i;j<=n;j+=i)
					s[j-1]=p[25].second;
				p[25].first-=k;
			}
			else
			{
				cout<<i<<" "<<p[25].first<<endl;
				ans=false;
				break;
			}
		}
	}
	sort(p.begin(), p.end());
	s[0]=p[25].second;
	if(ans)
	{
		cout<<"YES\n";
		cout<<s<<"\n";
	}
	else
		cout<<"NO\n";
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[26];
bool isprime[1000];
int main() {
	memset(isprime,1, sizeof isprime);
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    memset(a,0,sizeof a);
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++)
		a[s[i]-'a']++;
	vector<pair<int,char> > p;
	for(int i=0;i<26;i++)
		p.push_back(make_pair(a[i],'a'+i));

	int n=s.length();
	int k;
	bool ans=true;
	for(int i=2;i<=n;i++)
	{
		if(isprime[i])
		{
			for(int j=i*i;j<=n;j+=i)
				isprime[j]=false;
		}
	}
	sort(p.begin(), p.end());
	for(int i=0;i<n;i++)
	{
		if (!(i==0||(isprime[i+1]&&(i+1)*2>n)))
		{
			if(p[25].first)
			{
				s[i]=p[25].second;
				p[25].first--;
			}
			else
			{
				ans=false;
				break;
			}
		}
	}
	if(ans)
	{
		int j=0;
		for(int i=0;i<n;i++)
		{
			if(i==0||(isprime[i+1]&&(i+1)*2>n))
			{
				while(!p[j].first)
					j++;
				s[i]=p[j].second;
				p[j].first--;
			}
		}
		cout<<"YES"<<endl;
		cout<<s<<endl;
	}
	else
		cout<<"NO"<<endl;

	return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[26];
bool isprime[1000];
int main() {
	memset(isprime,1, sizeof isprime);
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    memset(a,0,sizeof a);
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++)
		a[s[i]-'a']++;
	vector<pair<int,char> > p;
	for(int i=0;i<26;i++)
		p.push_back(make_pair(a[i],'a'+i));
	int n=s.length();
	int k;
	bool ans=true;
	for(int i=2;i<=n;i++)
	{
		if(isprime[i])
		{
			k=1;
			for(int j=i*i;j<=n;j+=i)
			{
				if(isprime[j])
					{
						isprime[j]=false;
						k++;
					}
			}
			sort(p.begin(), p.end());
			if(p[25].first>=k)
			{
				s[i-1]=p[25].second;
				for(int j=i*i;j<=n;j+=i)
					s[j-1]=p[25].second;
				p[25].first-=k;
			}
			else
			{
				ans=false;
				break;
			}
		}
	}
	sort(p.begin(), p.end());
	s[0]=p[25].second;
	if(ans)
	{
		cout<<"YES\n";
		cout<<s<<"\n";
	}
	else
		cout<<"NO\n";
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[26];
bool isprime[1000];
int main() {
	memset(isprime,1, sizeof isprime);
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    memset(a,0,sizeof a);

	string s;
	cin>>s;
	for(int i=0;i<s.length();i++)
		a[s[i]-'a']++;
	vector<pair<int,char> > p;
	for(int i=0;i<26;i++)
		p.push_back(make_pair(a[i],'a'+i));
	int n=s.length();
	int k;
	bool ans=true;
	for(int i=2;i<=n;i++)
	{
		if(isprime[i])
		{
			k=1;
			for(int j=i*i;j<=n;j+=i)
			{
				isprime[j]=false;
				k++;
			}
			sort(p.begin(), p.end());
			if(p[25].first>=k)
			{
				s[i-1]=p[25].second;
				for(int j=i*i;j<=n;j+=i)
					s[j-1]=p[25].second;
				p[25].first-=k;
			}
			else
			{
				ans=false;
				break;
			}
		}
	}
	sort(p.begin(), p.end());
	s[0]=p[25].second;
	if(ans)
	{
		cout<<"YES\n";
		cout<<s<<"\n";
	}
	else
		cout<<"NO\n";
	return 0;
}


#include <map>
#include <set>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <bitset>
#include <time.h>
#include <fstream>
#include <sstream>
#include <numeric>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
#define li long long int
#define rep(i,to)	for(li i=0;i<((li)(to));++i)
#define pb       	push_back
#define sz(v)    	((li)(v).size())
#define bit(n)   	(1ll<<(li)(n))
#define each(it,c) \
for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define all(a) (a).begin(),(a).end()
#define MP make_pair
#define F first
#define S second

/*

#define MAX 205
#define _INF 1000000005ll
li INF=_INF*_INF;
li dp[MAX][MAX],n,m,k,len;
char ans[MAX];
char mp[MAX][MAX];
li rank[MAX];
li c[MAX][MAX];

li recur(li rem0,li rem1){
	if(rem1<rem0) return 0;
	if(rem0==0 && rem1==0) return 1;
	li &res=dp[rem0][rem1];
	if(res!=-1) return res;
	res=0;
	if(ans[rank[len-rem0-rem1]]!=')') res+=recur(rem0-1,rem1);
	if(ans[rank[len-rem0-rem1]]!='(') res+=recur(rem0,rem1-1);
	res=min(res,INF);
	return res;
}

int main(){
	cin>>n>>m>>k; k--;
	len=n+m-1;
	li cnt=0;
	rep(i,n)rep(j,m) cin>>c[i][j];
	vector<pair<li,pair<li,li> > > vec;
	rep(i,n)rep(j,m)vec.pb(MP(c[i][j],MP(i,j)));
	sort(all(vec));
	memset(rank,-1,sizeof(rank));
	rep(i,sz(vec)){
		li num=vec[i].S.F+vec[i].S.S;
		if(rank[num]!=-1) continue;
		rank[num]=cnt++;
	}
	rep(i,MAX) ans[i]='?';
	rep(i,len){
		ans[i]='(';
		memset(dp,-1,sizeof(dp));
		li tmp=recur(len/2,len/2);
		if(tmp<=k){
			ans[i]=')';
			k-=tmp;
		}
	}
	rep(i,len){
		li num=rank[i];
		for(li x=0;x<=i;x++){
			li y=i-x;
			if(y<0 || m<=y) continue;
			mp[x][y]=ans[num];
		}
	}
	rep(i,n){ rep(j,m) cout<<mp[i][j]; cout<<endl; }
}

*/
#define MAX 10005
li np[MAX];
char ans[MAX];

int main(){
	memset(np,0,sizeof(np));
	string str;
	cin>>str;
	li cnt=0;
	vector<li> vec;
	for(li i=2;i*2<=sz(str);i++)if(!np[i]){
		vec.pb(i);
		for(li j=i*i;j<=sz(str);j+=i)if(!np[j]){
			np[j]=1;
			vec.pb(j);
		}
	}
	rep(i,26)if(sz(vec)<=count(all(str),'a'+i)){
		vector<char> v;
		rep(j,sz(str))if(str[j]!='a'+i) v.pb(str[j]);
		rep(j,sz(str))if(str[j]=='a'+i) v.pb(str[j]);
		string ans(sz(str),'?');
		rep(j,sz(vec)){
			ans[vec[j]-1]=v.back();
			v.pop_back();
		}
		rep(j,sz(str))if(ans[j]=='?'){
			ans[j]=v.back();
			v.pop_back();
		}
		cout<<"YES"<<endl<<ans<<endl;
		return 0;
	}
	cout<<"NO"<<endl;
}


#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
const int N = 20;
const int M = 1 << N;

int st[M], one[M];
int link[N];
int n;

long long d[N][M];

void deal(int idx, int num, int stid, int s) {
	if (idx == n + 1) {
		st[s] = stid;
		one[s] = num;
		return ;
	}
	if (stid == -1)
		deal(idx + 1, num + 1, idx, s | (1 << idx));
	else
		deal(idx + 1, num + 1, stid, s | (1 << idx));

	deal(idx + 1, num, stid, s);
}

long long dp(int u, int s) {
	if (~d[u][s])
		return d[u][s];
	if (one[s] == 1 || one[s] == 2)
		return d[u][s] = 1;
	if (!(link[u] >> st[s] & 1))
		return d[u][s] = 0;
	d[u][s] = 0;
	int pre = s ^ (1 << u);
	for (int i = 0; i < n; ++i)
		if ((pre >> i & 1) && (link[i] >> st[pre] & 1) && (link[i] >> u & 1) &&
			(link[u] >> st[s] & 1)) {
				d[u][s] += dp(i, pre);
			}
	return d[u][s];
}

int main() {
	int m, u, v;
	scanf("%d", &n);
	scanf("%d", &m);
	while (m -- > 0) {
		scanf("%d%d", &u, &v);
		-- u;
		-- v;
		link[u] |= 1 << v;
		link[v] |= 1 << u;
	}
	deal(0, 0, -1, 0);

	memset(d, -1, sizeof d);
	int mx = (1 << n) - 1;
	long long ans = 0;
	for (int i = 0; i <= mx; ++i)
		if (one[i] > 2)
			for (int j = 0; j < n; ++j) {
				if (j == st[i])
					continue;
				if (i >> j & 1)
					ans += dp(j, i);
			}

	printf("%I64d\n", ans / 2);
	return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
const int N = 20;
const int M = 1 << N;

int st[M], one[M];
long long link[N];
int n;

long long d[N][M];

void deal(int idx, int num, int stid, int s) {
    if (idx == n + 1) {
        st[s] = stid;
        one[s] = num;
        return ;
    }
    if (stid == -1)
        deal(idx + 1, num + 1, idx, s | (1 << idx));
    else
        deal(idx + 1, num + 1, stid, s | (1 << idx));

    deal(idx + 1, num, stid, s);
}

long long dp(int u, int s) {
    if (d[u][s] >= 0)
        return d[u][s];
    if (one[s] == 1 || one[s] == 2)
        return d[u][s] = 1;

    d[u][s] = 0;
    int pre = s ^ (1 << u);
    for (int i = 0; i < n; ++i)
        if ((pre >> i & 1) && (link[i] >> st[pre] & 1) &&
            (link[i] >> u & 1)) {
                d[u][s] += dp(i, pre);
        }
    return d[u][s];
}

int main() {
    int m, u, v;
    scanf("%d", &n);
    scanf("%d", &m);
    while (m -- > 0) {
        scanf("%d%d", &u, &v);
        -- u;
        -- v;
        link[u] |= 1 << v;
        link[v] |= 1 << u;
    }

    deal(0, 0, -1, 0);

    memset(d, -1, sizeof d);
    int mx = (1 << n) - 1;
    long long ans = 0;
    for (int i = 0; i <= mx; ++i)
        if (one[i] > 2)
            for (int j = 0; j < n; ++j) {
                if (j == st[i])
                    continue;
                if ((i >> j & 1) && (link[j] >> st[i] & 1))
                    ans += dp(j, i);
            }

    printf("%I64d\n", ans / 2);
    return 0;
}