//Author:Medo king
//ان الله لا يضيع اجر من احسن عملا
#include <cstring>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <list>
#include <climits>
#include <map>
#include <cctype>
#include <bitset>
#include <math.h>
#include <cassert>
#include <cstring>
#define ll long long
#define ld long double
#define e15 100005
#define wrong .0000001
#define PI 3.14159265
#define oo 0x3f3f3f3f
#define rep (i == x ? '\n' : ' ')
#define MEDO_journey_TO_ICPC ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0)

using namespace std;

//ll di[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
//ll dj[] = { 1, -1, 0, 0, -1, 1, 1, -1 };

//ll lcm(ll first, ll second) { return (first / gcd(first, second)) * second; }
//ll gcd(ll first, ll second) { return !second ? first : gcd(second, first % second); }

//ll x, y;
//char a, b;
//string s;
//map<char, deque<ll>>pp;
//priority_queue<ll>dp;
//deque<pair<char, pair<char, ll>>>q;
//
//void dfs(ll n, ll ss){
//	string p = s;
//	reverse(p.begin(), p.end());
//	if (p == s){
//		dp.push(ss);
//		return;
//	}
//	if (n == x){
//		return;
//	}
//	char r = q[n].first;
//	if (s.find(q[n].first) != -1){
//		ll cc = 0;
//		for (int i = 0; i < pp[q[n].first].size(); i++){
//			s[pp[q[n].first][i]] = q[n].second.first;
//			pp[q[n].second.first].push_back(pp[q[n].first][i]);
//		}
//		cc += q[n].second.second;
//		dfs(n + 1, ss + cc);
//		for (int i = 0; i < pp[r].size(); i++){
//			s[pp[r][i]] = r;
//			pp[q[n].second.first].pop_back();
//		}
//	}
//	dfs(n + 1, ss);
//}

ll x, y, z;
string s;
char ss[1005];
deque<ll>q;
map<char, pair<ll, ll>>p;

bool rec(ll n){
	if (n == 1){
		return 0;
	}
	for (int i = 2; i * i <= n; i++){
		if (n % i == 0){
			return 0;
		}
	}
	return 1;
}

int main(){

	MEDO_journey_TO_ICPC;

	/*cin >> s >> x;

	for (int i = 0; i < x; i++){
		cin >> a >> b >> y;
		q.push_back({ a, { b, y } });
	}

	string ss = s;

	reverse(ss.begin(), ss.end());

	if (s == ss){
		cout << 0 << endl;
		return 0;
	}

	for (int i = 0; i < s.size(); i++){
		pp[s[i]].push_back(i);
	}

	dfs(0, 0);

	if (dp.empty()){
		cout << "Croatia wins!!" << endl;
	}

	else{
		cout << dp.top() << endl;
	}*/

	cin >> s;

	for (int i = 0; i < s.size(); i++){
		p[s[i]] = { p[s[i]].first + 1, i };
	}

	for (int i = 1; i <= s.size(); i++){
		if (rec(i)){
			q.push_back(i);
		}
	}
	ll b = 0;
	for (int i = 0; i < q.size(); i++){
		set<ll>a;
		a.insert(q[i] - 1);
		for (int j = 0; j < s.size() / q[i]; j++){
			if ((j + 1) * q[i] - 1 < s.size() && (ss[(j + 1) * q[i] - 1 < s.size()] < 'a' || ss[(j + 1) * q[i] - 1 < s.size()] > 'z')){
				a.insert((j + 1) * q[i] - 1);
			}
			else{
				break;
			}
		}
		for (auto j : p){
			if (j.second.first >= a.size()){
				b++;
				p[j.first].first -= a.size();
				set<ll>::iterator it = a.begin();
				for (; it != a.end(); it++){
					ss[*it] = j.first;
				}
				break;
			}
		}
		a.clear();
	}
	if (b == q.size()){
		cout << "YES" << endl;
		for (int i = 0; i < s.size(); i++){
			if (ss[i] >= 'a' && ss[i] <= 'z'){
				continue;
			}
			else{
				for (auto j : p){
					if (j.second.first){
						ss[i] = j.first;
						p[j.first].first--;
						break;
					}
				}
			}
		}
		for (int i = 0; i < s.size(); i++){
			cout << ss[i];
		}
		cout << endl;
	}
	else{
		cout << "NO" << endl;
	}
	return 0;
}


//Author:Medo king
//ان الله لا يضيع اجر من احسن عملا
#include <cstring>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <list>
#include <climits>
#include <map>
#include <cctype>
#include <bitset>
#include <math.h>
#include <cassert>
#include <cstring>
#define ll long long
#define ld long double
#define e15 100005
#define wrong .0000001
#define PI 3.14159265
#define oo 0x3f3f3f3f
#define rep (i == x ? '\n' : ' ')
#define MEDO_journey_TO_ICPC ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

using namespace std;

//ll di[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
//ll dj[] = { 1, -1, 0, 0, -1, 1, 1, -1 };

//ll lcm(ll first, ll second) { return (first / gcd(first, second)) * second; }
//ll gcd(ll first, ll second) { return !second ? first : gcd(second, first % second); }

//ll x, y;
//char a, b;
//string s;
//map<char, deque<ll>>pp;
//priority_queue<ll>dp;
//deque<pair<char, pair<char, ll>>>q;
//
//void dfs(ll n, ll ss){
//	string p = s;
//	reverse(p.begin(), p.end());
//	if (p == s){
//		dp.push(ss);
//		return;
//	}
//	if (n == x){
//		return;
//	}
//	char r = q[n].first;
//	if (s.find(q[n].first) != -1){
//		ll cc = 0;
//		for (int i = 0; i < pp[q[n].first].size(); i++){
//			s[pp[q[n].first][i]] = q[n].second.first;
//			pp[q[n].second.first].push_back(pp[q[n].first][i]);
//		}
//		cc += q[n].second.second;
//		dfs(n + 1, ss + cc);
//		for (int i = 0; i < pp[r].size(); i++){
//			s[pp[r][i]] = r;
//			pp[q[n].second.first].pop_back();
//		}
//	}
//	dfs(n + 1, ss);
//}

//ll x, y, z;
string s;
char ss[1005];
deque<ll>q;
map<char, pair<ll, ll>>p;

bool rec(ll n){
	if (n == 1){
		return 0;
	}
	for (int i = 2; i * i <= n; i++){
		if (n % i == 0){
			return 0;
		}
	}
	return 1;
}
//string s;
//map<char, ll>p;

int main(){

	MEDO_journey_TO_ICPC;
	/*char c = 'a';
	for (int i = 1; c <= 'z'; c++, i++){
		p[c] = i;
	}
	cin >> x >> y >> s;
	z++;
	sort(s.begin(), s.end());
	ll mini = p[s[0]], ans = p[s[0]];
	for (int i = 1; i < s.size() && z < y; i++){
		if (abs(p[s[i]] - mini) > 1){
			z++, ans += p[s[i]], mini = p[s[i]];
		}
	}
	if (z == y){
		cout << ans << endl;
	}
	else{
		cout << -1 << endl;
	}*/
	/*cin >> s >> x;

	for (int i = 0; i < x; i++){
		cin >> a >> b >> y;
		q.push_back({ a, { b, y } });
	}

	string ss = s;

	reverse(ss.begin(), ss.end());

	if (s == ss){
		cout << 0 << endl;
		return 0;
	}

	for (int i = 0; i < s.size(); i++){
		pp[s[i]].push_back(i);
	}

	dfs(0, 0);

	if (dp.empty()){
		cout << "Croatia wins!!" << endl;
	}

	else{
		cout << dp.top() << endl;
	}*/

	cin >> s;

	for (int i = 0; i < s.size(); i++){
		p[s[i]] = { p[s[i]].first + 1, i };
	}

	for (int i = 1; i <= s.size(); i++){
		if (rec(i)){
			q.push_back(i);
		}
	}
	ll b = 0;
	for (int i = 0; i < q.size(); i++){
		set<ll>a;
		a.insert(q[i] - 1);
		for (int j = 0; j < s.size() / q[i]; j++){
			if ((j + 1) * q[i] - 1 < s.size() && (ss[(j + 1) * q[i] - 1] < 'a' || ss[(j + 1) * q[i] - 1] > 'z')){
				a.insert((j + 1) * q[i] - 1);
			}
		}
		for (auto j : p){
			if (j.second.first >= a.size()){
				p[j.first].first -= a.size();
				set<ll>::iterator it = a.begin();
				for (; it != a.end(); it++){
					ss[*it] = j.first;
				}
				break;
			}
		}
		a.clear();
	}
	for (int i = 0; i < s.size(); i++){
		if (ss[i] >= 'a' && ss[i] <= 'z'){
			continue;
		}
		else{
			for (auto j : p){
				if (j.second.first){
					ss[i] = j.first;
					p[j.first].first--;
					break;
				}
			}
		}
	}
	bool ok = 1;
	for (int i = 0; i < q.size(); i++){
		for (int j = 0; j < s.size() / q[i]; j++){
			if (ss[q[i] - 1] != ss[(j + 1) * q[i] - 1]){
				ok = 0;
				break;
			}
		}
	}
	if (ok){
		cout << "YES" << endl;
		for (int i = 0; i < s.size(); i++){
			cout << ss[i];
		}
		cout << endl;
	}
	else{
		cout << "NO" << endl;
	}
	return 0;
}


//Author:Medo king
//ان الله لا يضيع اجر من احسن عملا
#include <cstring>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <list>
#include <climits>
#include <map>
#include <cctype>
#include <bitset>
#include <math.h>
#include <cassert>
#include <cstring>
#define ll long long
#define ld long double
#define e15 100005
#define wrong .0000001
#define PI 3.14159265
#define oo 0x3f3f3f3f
#define rep (i == x ? '\n' : ' ')
#define MEDO_journey_TO_ICPC ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0)

using namespace std;

//ll di[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
//ll dj[] = { 1, -1, 0, 0, -1, 1, 1, -1 };

//ll lcm(ll first, ll second) { return (first / gcd(first, second)) * second; }
//ll gcd(ll first, ll second) { return !second ? first : gcd(second, first % second); }

//ll x, y;
//char a, b;
//string s;
//map<char, deque<ll>>pp;
//priority_queue<ll>dp;
//deque<pair<char, pair<char, ll>>>q;
//
//void dfs(ll n, ll ss){
//	string p = s;
//	reverse(p.begin(), p.end());
//	if (p == s){
//		dp.push(ss);
//		return;
//	}
//	if (n == x){
//		return;
//	}
//	char r = q[n].first;
//	if (s.find(q[n].first) != -1){
//		ll cc = 0;
//		for (int i = 0; i < pp[q[n].first].size(); i++){
//			s[pp[q[n].first][i]] = q[n].second.first;
//			pp[q[n].second.first].push_back(pp[q[n].first][i]);
//		}
//		cc += q[n].second.second;
//		dfs(n + 1, ss + cc);
//		for (int i = 0; i < pp[r].size(); i++){
//			s[pp[r][i]] = r;
//			pp[q[n].second.first].pop_back();
//		}
//	}
//	dfs(n + 1, ss);
//}

ll x, y, z;
string s;
char ss[1005];
deque<ll>q;
map<char, pair<ll, ll>>p;

bool rec(ll n){
	if (n == 1){
		return 0;
	}
	for (int i = 2; i * i <= n; i++){
		if (n % i == 0){
			return 0;
		}
	}
	return 1;
}

int main(){

	MEDO_journey_TO_ICPC;

	/*cin >> s >> x;

	for (int i = 0; i < x; i++){
		cin >> a >> b >> y;
		q.push_back({ a, { b, y } });
	}

	string ss = s;

	reverse(ss.begin(), ss.end());

	if (s == ss){
		cout << 0 << endl;
		return 0;
	}

	for (int i = 0; i < s.size(); i++){
		pp[s[i]].push_back(i);
	}

	dfs(0, 0);

	if (dp.empty()){
		cout << "Croatia wins!!" << endl;
	}

	else{
		cout << dp.top() << endl;
	}*/

	cin >> s;

	for (int i = 0; i < s.size(); i++){
		p[s[i]] = { p[s[i]].first + 1, i };
	}

	for (int i = 1; i <= s.size(); i++){
		if (rec(i)){
			q.push_back(i);
		}
	}
	ll b = 0;
	for (int i = 0; i < q.size(); i++){
		set<ll>a;
		a.insert(q[i] - 1);
		for (int j = 0; j < s.size() / q[i]; j++){
			if ((j + 1) * q[i] - 1 < s.size() && (ss[(j + 1) * q[i] - 1] < 'a' || ss[(j + 1) * q[i] - 1] > 'z')){
				a.insert((j + 1) * q[i] - 1);
			}
		}
		for (auto j : p){
			if (j.second.first >= a.size()){
				b++;
				p[j.first].first -= a.size();
				set<ll>::iterator it = a.begin();
				for (; it != a.end(); it++){
					ss[*it] = j.first;
				}
				break;
			}
		}
		a.clear();
	}
	if (b == q.size()){
		cout << "YES" << endl;
		for (int i = 0; i < s.size(); i++){
			if (ss[i] >= 'a' && ss[i] <= 'z'){
				continue;
			}
			else{
				for (auto j : p){
					if (j.second.first){
						ss[i] = j.first;
						p[j.first].first--;
						break;
					}
				}
			}
		}
		for (int i = 0; i < s.size(); i++){
			cout << ss[i];
		}
		cout << endl;
	}
	else{
		cout << "NO" << endl;
	}
	return 0;
}


//Author:Medo king
//ان الله لا يضيع اجر من احسن عملا
#include <cstring>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <list>
#include <climits>
#include <map>
#include <cctype>
#include <bitset>
#include <math.h>
#include <cassert>
#include <cstring>
#define ll long long
#define ld long double
#define e15 100005
#define wrong .0000001
#define PI 3.14159265
#define oo 0x3f3f3f3f
#define rep (i == x ? '\n' : ' ')
#define MEDO_journey_TO_ICPC ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

using namespace std;

//ll di[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
//ll dj[] = { 1, -1, 0, 0, -1, 1, 1, -1 };

//ll lcm(ll first, ll second) { return (first / gcd(first, second)) * second; }
//ll gcd(ll first, ll second) { return !second ? first : gcd(second, first % second); }

//ll x, y;
//char a, b;
//string s;
//map<char, deque<ll>>pp;
//priority_queue<ll>dp;
//deque<pair<char, pair<char, ll>>>q;
//
//void dfs(ll n, ll ss){
//	string p = s;
//	reverse(p.begin(), p.end());
//	if (p == s){
//		dp.push(ss);
//		return;
//	}
//	if (n == x){
//		return;
//	}
//	char r = q[n].first;
//	if (s.find(q[n].first) != -1){
//		ll cc = 0;
//		for (int i = 0; i < pp[q[n].first].size(); i++){
//			s[pp[q[n].first][i]] = q[n].second.first;
//			pp[q[n].second.first].push_back(pp[q[n].first][i]);
//		}
//		cc += q[n].second.second;
//		dfs(n + 1, ss + cc);
//		for (int i = 0; i < pp[r].size(); i++){
//			s[pp[r][i]] = r;
//			pp[q[n].second.first].pop_back();
//		}
//	}
//	dfs(n + 1, ss);
//}

//ll x, y, z;
string s;
char ss[1005];
deque<ll>q;
map<ll, char>dp;
map<char, pair<ll, ll>>p;

bool rec(ll n){
	if (n == 1){
		return 0;
	}
	for (int i = 2; i * i <= n; i++){
		if (n % i == 0){
			return 0;
		}
	}
	return 1;
}
//string s;
//map<char, ll>p;

int main(){

	MEDO_journey_TO_ICPC;
	/*char c = 'a';
	for (int i = 1; c <= 'z'; c++, i++){
		p[c] = i;
	}
	cin >> x >> y >> s;
	z++;
	sort(s.begin(), s.end());
	ll mini = p[s[0]], ans = p[s[0]];
	for (int i = 1; i < s.size() && z < y; i++){
		if (abs(p[s[i]] - mini) > 1){
			z++, ans += p[s[i]], mini = p[s[i]];
		}
	}
	if (z == y){
		cout << ans << endl;
	}
	else{
		cout << -1 << endl;
	}*/
	/*cin >> s >> x;

	for (int i = 0; i < x; i++){
		cin >> a >> b >> y;
		q.push_back({ a, { b, y } });
	}

	string ss = s;

	reverse(ss.begin(), ss.end());

	if (s == ss){
		cout << 0 << endl;
		return 0;
	}

	for (int i = 0; i < s.size(); i++){
		pp[s[i]].push_back(i);
	}

	dfs(0, 0);

	if (dp.empty()){
		cout << "Croatia wins!!" << endl;
	}

	else{
		cout << dp.top() << endl;
	}*/

	cin >> s;

	for (int i = 0; i < s.size(); i++){
		p[s[i]] = { p[s[i]].first + 1, i };
	}
	for (int i = 1; i <= s.size(); i++){
		if (rec(i)){
			q.push_back(i);
		}
	}
	for (int i = 0; i < q.size(); i++){
		deque<ll>a;
		set<ll>b;
		set<char>pq;
		a.push_back(q[i] - 1);
		b.insert(q[i] - 1);
		for (int j = 1; j < s.size() / q[i]; j++){
			if ((j + 1) * q[i] - 1 < s.size()){
				a.push_back((j + 1) * q[i] - 1);
				if (dp[(j + 1) * q[i] - 1] >= 'a'&&dp[(j + 1) * q[i] - 1] <= 'z'){
					pq.insert(dp[(j + 1) * q[i] - 1]);
				}
			}
			if ((j + 1) * q[i] - 1 < s.size() && (ss[(j + 1) * q[i] - 1] < 'a' || ss[(j + 1) * q[i] - 1] > 'z')){
				b.insert((j + 1) * q[i] - 1);
			}
		}
		for (auto j : p){
			if (j.second.first >= a.size() && a.size() == b.size()){
				p[j.first].first -= b.size();
				for (int k = 0; k < a.size(); k++){
					dp[a[k]] = j.first;
					ss[a[k]] = j.first;
				}
				break;
			}
			if (j.second.first >= b.size() && a.size() != b.size()){
				set<char>::iterator il = pq.begin();
				if (j.first == *il){
					p[j.first].first -= b.size();
					for (set<ll>::iterator it = b.begin(); it != b.end(); it++){
						ss[*it] = *il;
						dp[*it] = *il;
					}
					break;
				}
				else{
					continue;
				}
			}
		}
		a.clear();
		b.clear();
	}
	for (int i = 0; i < s.size(); i++){
		if (ss[i] >= 'a' && ss[i] <= 'z'){
			continue;
		}
		else{
			for (auto j : p){
				if (j.second.first){
					ss[i] = j.first;
					p[j.first].first--;
					break;
				}
			}
		}
	}
	bool ok = 1;
	for (int i = 0; i < q.size(); i++){
		for (int j = 0; j < s.size() / q[i]; j++){
			if (ss[q[i] - 1] != ss[(j + 1) * q[i] - 1]){
				ok = 0;
				break;
			}
		}
	}
	if (ok){
		cout << "YES" << endl;
		for (int i = 0; i < s.size(); i++){
			cout << ss[i];
		}
		cout << endl;
	}
	else{
		cout << "NO" << endl;
	}
	return 0;
}


//Author:Medo king
//ان الله لا يضيع اجر من احسن عملا
//#include "stdafx.h"
#include <cstring>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <list>
#include <climits>
#include <map>
#include <cctype>
#include <bitset>
#include <math.h>
#include <cassert>
#include <cstring>
#define ll long long
#define ld long double
#define e15 100005
#define wrong .0000001
#define PI 3.14159265
#define oo 0x3f3f3f3f
#define rep (i == x ? '\n' : ' ')
#define MEDO_journey_TO_ICPC ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

using namespace std;

//ll di[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
//ll dj[] = { 1, -1, 0, 0, -1, 1, 1, -1 };

//ll lcm(ll first, ll second) { return (first / gcd(first, second)) * second; }
//ll gcd(ll first, ll second) { return !second ? first : gcd(second, first % second); }

//ll x, y;
//char a, b;
//string s;
//map<char, deque<ll>>pp;
//priority_queue<ll>dp;
//deque<pair<char, pair<char, ll>>>q;
//
//void dfs(ll n, ll ss){
//	string p = s;
//	reverse(p.begin(), p.end());
//	if (p == s){
//		dp.push(ss);
//		return;
//	}
//	if (n == x){
//		return;
//	}
//	char r = q[n].first;
//	if (s.find(q[n].first) != -1){
//		ll cc = 0;
//		for (int i = 0; i < pp[q[n].first].size(); i++){
//			s[pp[q[n].first][i]] = q[n].second.first;
//			pp[q[n].second.first].push_back(pp[q[n].first][i]);
//		}
//		cc += q[n].second.second;
//		dfs(n + 1, ss + cc);
//		for (int i = 0; i < pp[r].size(); i++){
//			s[pp[r][i]] = r;
//			pp[q[n].second.first].pop_back();
//		}
//	}
//	dfs(n + 1, ss);
//}

//ll x, y, z;
string s;
char ss[1005];
deque<ll>q;
map<ll, char>dp;
map<char, pair<ll, ll>>p;

bool rec(ll n){
	if (n == 1){
		return 0;
	}
	for (int i = 2; i * i <= n; i++){
		if (n % i == 0){
			return 0;
		}
	}
	return 1;
}
//string s;
//map<char, ll>p;

int main(){

	MEDO_journey_TO_ICPC;
	/*char c = 'a';
	for (int i = 1; c <= 'z'; c++, i++){
		p[c] = i;
	}
	cin >> x >> y >> s;
	z++;
	sort(s.begin(), s.end());
	ll mini = p[s[0]], ans = p[s[0]];
	for (int i = 1; i < s.size() && z < y; i++){
		if (abs(p[s[i]] - mini) > 1){
			z++, ans += p[s[i]], mini = p[s[i]];
		}
	}
	if (z == y){
		cout << ans << endl;
	}
	else{
		cout << -1 << endl;
	}*/
	/*cin >> s >> x;

	for (int i = 0; i < x; i++){
		cin >> a >> b >> y;
		q.push_back({ a, { b, y } });
	}

	string ss = s;

	reverse(ss.begin(), ss.end());

	if (s == ss){
		cout << 0 << endl;
		return 0;
	}

	for (int i = 0; i < s.size(); i++){
		pp[s[i]].push_back(i);
	}

	dfs(0, 0);

	if (dp.empty()){
		cout << "Croatia wins!!" << endl;
	}

	else{
		cout << dp.top() << endl;
	}*/

	cin >> s;

	for (int i = 0; i < s.size(); i++){
		p[s[i]] = { p[s[i]].first + 1, i };
	}
	for (int i = 1; i <= s.size(); i++){
		if (rec(i)){
			q.push_back(i);
		}
	}
	for (int i = 0; i < q.size(); i++){
		deque<ll>a;
		set<ll>b;
		set<char>pq;
		a.push_back(q[i] - 1);
		b.insert(q[i] - 1);
		for (int j = 1; j < s.size() / q[i]; j++){
			if ((j + 1) * q[i] - 1 < s.size()){
				a.push_back((j + 1) * q[i] - 1);
				if (dp[(j + 1) * q[i] - 1] >= 'a'&&dp[(j + 1) * q[i] - 1] <= 'z'){
					pq.insert(dp[(j + 1) * q[i] - 1]);
				}
			}
			if ((j + 1) * q[i] - 1 < s.size() && (ss[(j + 1) * q[i] - 1] < 'a' || ss[(j + 1) * q[i] - 1] > 'z')){
				b.insert((j + 1) * q[i] - 1);
			}
		}
		for (auto j : p){
			if (j.second.first >= a.size() && a.size() == b.size()){
				p[j.first].first -= b.size();
				for (int k = 0; k < a.size(); k++){
					dp[a[k]] = j.first;
					ss[a[k]] = j.first;
				}
				break;
			}
			if (j.second.first >= b.size() && a.size() != b.size()){
				set<char>::iterator il = pq.begin();
				if (j.first == *il){
					p[j.first].first -= b.size();
					for (set<ll>::iterator it = b.begin(); it != b.end(); it++){
						ss[*it] = *il;
						dp[*it] = *il;
					}
					break;
				}
				else{
					continue;
				}
			}
		}
		a.clear();
		b.clear();
	}
	for (int i = 0; i < s.size(); i++){
		if (ss[i] >= 'a' && ss[i] <= 'z'){
			continue;
		}
		else{
			for (auto j : p){
				if (j.second.first){
					ss[i] = j.first;
					p[j.first].first--;
					break;
				}
			}
		}
	}
	bool ok = 1;
	for (int i = 0; i < q.size(); i++){
		for (int j = 0; j < s.size() / q[i]; j++){
			if (ss[q[i] - 1] != ss[(j + 1) * q[i] - 1]){
				ok = 0;
				break;
			}
		}
	}
	if (ok){
		cout << "YES" << endl;
		for (int i = 0; i < s.size(); i++){
			cout << ss[i];
		}
		cout << endl;
	}
	else{
		cout << "NO" << endl;
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ss string
#define pb push_back
#define rev(i,n) for(ll i=0;i<n;i++)
#define rev1(i,n) for(ll i=n-1;i>=0;i--)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(),v.end()
#define S second
#define F first
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define MOD 1000000007
#define m(x) x%MOD
#define  rep(i,start,lim) for(ll (i)=(start);i<(lim);i++)
bool IsPrime(ll x){bool isPrime=true;for(ll a=2;a*a<=x;a++){if(x%a==0)return false;}return true;}
using namespace std;
map<char,ll> m;
int32_t main()
{
        sync;
        ss a,ans;cin>>a;ll c=a.length(),p,k;if(a.length()==1){cout<<"NO";return 0;}char b;
        rev1(i,c+1)
        {
            if(IsPrime(i) && c%i==0)
            {
                p=i;k=c/i;
                break;
            }
        }
        rev(i,a.length()){m[a[i]]++; } ll q=0;
        tci(m,i)
        {
            if(i->S>=k)
            {
                q++;
                b=i->F;m[i->F]-=k;if(m[i->F]==0){m.erase(i->F);  }   break;
            }

        }
        if(q==0){cout<<"NO";return 0;}
        rev(i,a.length()){ans+='.';} ll j=p-1;
        while(j<a.length())
        {
            ans[j]=b;
            j+=p;
        }
        rev(i,a.length())
        {
            if(ans[i]=='.')
            {
                auto it=m.begin();;
                ans[i]=it->F;
                m[it->F]--;
                if(m[it->F]==0){m.erase(it->F);  }
            }
        }
        cout<<"YES"<<endl;
        cout<<ans;
}


#include<bits/stdc++.h>
#define ll long long
#define ss string
#define pb push_back
#define rev(i,n) for(ll i=0;i<n;i++)
#define rev1(i,n) for(ll i=n-1;i>=0;i--)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(),v.end()
#define S second
#define F first
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define MOD 1000000007
#define m(x) x%MOD
#define  rep(i,start,lim) for(ll (i)=(start);i<(lim);i++)
bool IsPrime(ll x){bool isPrime=true;for(ll a=2;a*a<=x;a++){if(x%a==0)return false;}return true;}
using namespace std;
map<char,ll> m;
ll A[1000005];
int32_t main()
{
        sync;
        ss a,ans;cin>>a;ll c=0,p=a.length(),check=0,k;char b;
        rep(i,2,a.length()/2+1)
        {
            if(A[i]==0)
            for(ll j=i;j<=p;j+=i)
            {
                A[j]++;
            }
        }

        rev(i,a.length()+1){ if(A[i]>0)c++;}
        rev(i,a.length()){m[a[i]]++;}
        tci(m,i)
        {
            if(i->S>=c){ b=i->F; check++;m[i->F]-=c;if(m[i->F]==0)m.erase(i->F);break; }
        }
        if(check==0){ cout<<"NO";return 0;}
        rev(i,a.length()){ if(A[i+1]>0){ ans+=b;}else ans+='.';}
        rev(i,a.length())
        {
            if(ans[i]=='.')
            {
                auto it=m.begin();
                ans[i]=it->F;
                m[it->F]--;
                if(m[it->F]==0)m.erase(it->F);
            }
        }
        cout<<"YES"<<endl;
        cout<<ans;
}


#include<bits/stdc++.h>
#define ll long long
#define ss string
#define pb push_back
#define rev(i,n) for(ll i=0;i<n;i++)
#define rev1(i,n) for(ll i=n-1;i>=0;i--)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(),v.end()
#define S second
#define F first
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define MOD 1000000007
#define m(x) x%MOD
#define  rep(i,start,lim) for(ll (i)=(start);i<(lim);i++)
bool IsPrime(ll x){bool isPrime=true;for(ll a=2;a*a<=x;a++){if(x%a==0)return false;}return true;}
using namespace std;
map<char,ll> m;
ll A[1000005];
int32_t main()
{
        sync;
        ss a,ans;cin>>a;ll c=0,p=a.length(),check=0,k;if(a.length()==1){cout<<"NO";return 0;}char b;
        rep(i,2,a.length()/2+1)
        {
            if(A[i]==0)
            for(ll j=i;j<=p;j+=i)
            {
                A[j]++;
            }
        }

        rev(i,a.length()+1){ if(A[i]>0)c++;}
        rev(i,a.length()){m[a[i]]++;}
        tci(m,i)
        {
            if(i->S>=c){ b=i->F; check++;m[i->F]-=c;if(m[i->F]==0)m.erase(i->F);break; }
        }
        if(check==0){ cout<<"NO";return 0;}
        rev(i,a.length()){ if(A[i+1]>0){ ans+=b;}else ans+='.';}
        rev(i,a.length())
        {
            if(ans[i]=='.')
            {
                auto it=m.begin();
                ans[i]=it->F;
                m[it->F]--;
                if(m[it->F]==0)m.erase(it->F);
            }
        }
        cout<<"YES"<<endl;
        cout<<ans;
}


#include <bits/stdc++.h>
using namespace std;
string s,ans;
int mp[26];
bool done[1005],vis[1005];
map<int,set<int> >f;
vector<bool>p(1005,1);
void sieve(){
    p[0]=p[1]=0;
    for(int i=2; i<p.size(); i++){
        if(!p[i])
            continue ;
        f[i].insert(i);
        for(int j=i*2; j<=p.size(); j+=i)
            f[j].insert(i),p[j]=0;
    }
}
int main()
{
    ios::sync_with_stdio(0);
    sieve();
    cin>>s;
    for(auto i : s)
        mp[i-'a']++;
    ans.resize(s.size());
    for(int i=2; i<=s.size(); i++){
        set<int>ss;
        if(p[i] && !done[i]){
            for(int j=2; j<=s.size(); j++){
                if(j%i==0){
                    for(auto k : f[j])
                        ss.insert(k),done[k]=1;
                }
            }
            char ch;
            int mx=0;
            for(int j=0; j<26; j++)
                if(mp[j]>mx)
                    mx=mp[j],ch='a'+j;
            for(int j=2; j<=s.size(); j++){
                bool ok=0;
                for(auto k : ss){
                    if(j%k==0){
                        ok=1;
                        break;
                    }
                }
                if(ok)
                    ans[j-1]=ch,mp[ch-'a']--,vis[j-1]=1;
                if(mp[ch-'a'] < 0)
                    return cout<<"NO",0;
            }
        }
    }
    for(int i=0; i<s.size(); i++){
        if(!vis[i]){
            bool ok=0;
            for(int j=0; j<26; j++){
                if(mp[j]>0)
                    ans[i]='a'+j,mp[j]--,ok=1,j=26;
            }
            if(!ok)
                return cout<<"NO",0;
        }
    }
    cout<<"YES"<<endl<<ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
string s,ans;
int mp[26];
bool done[1005],vis[1005];
map<int,set<int> >f;
vector<bool>p(1005,1);
void sieve(){
    p[0]=p[1]=0;
    for(int i=2; i<p.size(); i++){
        if(!p[i])
            continue ;
        f[i].insert(i);
        for(int j=i*2; j<=p.size(); j++)
            f[j].insert(i),p[j]=0;
    }
}
int main()
{
    ios::sync_with_stdio(0);
    sieve();
    cin>>s;
    for(auto i : s)
        mp[i-'a']++;
    ans.resize(s.size());
    for(int i=2; i<=s.size(); i++){
        set<int>ss;
        if(p[i] && !done[i]){
            for(int j=2; j<=s.size(); j++){
                if(f[j].count(i)){
                    for(auto k : f[j])
                        ss.insert(k),done[k]=1;
                }
            }
            char ch;
            int mx=0;
            for(int j=0; j<26; j++)
                if(mp[j]>mx)
                    mx=mp[j],ch='a'+j;
            for(int j=2; j<=s.size(); j++){
                bool ok=0;
                for(auto k : ss){
                    if(j%k==0){
                        ok=1;
                        break;
                    }
                }
                if(ok)
                    ans[j-1]=ch,mp[ch-'a']--,vis[j-1]=1;
                if(mp[ch-'a'] < 0)
                    return cout<<"NO",0;
            }
        }
    }
    for(int i=0; i<s.size(); i++){
        if(!vis[i]){
            bool ok=0;
            for(int j=0; j<26; j++){
                if(mp[j]>0)
                    ans[i]='a'+j,mp[j]--,ok=1,j=26;
            }
            if(!ok)
                return cout<<"NO",0;
        }
    }
    cout<<"YES"<<endl<<ans<<endl;
    return 0;
}


// g++ -std=c++14
#include<bits/stdc++.h>
typedef long long int lli;
typedef long double lld;
using namespace std;

#define sd(x) scanf("%d",&x);
#define sd2(x,y) scanf("%d%d",&x,&y);
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z);

#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

#define LET(x, a)  __typeof(a) x(a)
#define foreach(it, v) for(LET(it, v.begin()); it != v.end(); it++)
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
string s;
vector<char>ans;
vector<pair<int,char> >cnt(26);
vector<int>vis(1001,0);
int main(){
  _
  for(int i=0;i<26;i++){
    cnt[i].se = (char)'a'+i;
    cnt[i].fi = 0;
  }
  cin >> s;
  ans.resize(s.size()+1);
  for(int i=1;i<ans.size();i++){
    ans[i] = 'X';
  }
  for(int i=0;i<s.size();i++){
    cnt[s[i]-'a'].fi++;
  }
  sort(cnt.begin(),cnt.end(),greater<pair<int,char> >());
  for(int i=2;i<=s.size();i++){
    if(i>2 and 2*i<=s.size() and vis[i]==0){
      for(int j=i;j<=s.size();j+=i){
        if(ans[j]=='X'){
          if(cnt[ans[2]].fi<0){
            cout << "NO\n";
            return 0;
          }
          ans[j] = ans[2];
          cnt[ans[2]].fi--;
        }
        vis[j] = i;
      }
    }
    else if(vis[i]==0){
      int q = (s.size())/i;
      if(cnt[0].fi<q){
        cout << "NO\n";
        return 0;
      }
      for(int j=i;j<=s.size();j+=i){
        vis[j] = i;
        cnt[0].fi--;
        ans[j] = cnt[0].se;
      }
    }
    sort(cnt.begin(),cnt.end(),greater<pair<int,char> >());
  }
  for(int i=1;i<ans.size();i++){
    if(ans[i]=='X'){
      sort(cnt.begin(),cnt.end(),greater<pair<int,char> >());
      ans[i] = cnt[0].se;
      cnt[0].fi--;
    }
  }
  cout << "YES\n";
  for(int i=1;i<ans.size();i++){
    cout << ans[i];
  }
  cout << "\n";
  return 0;
}


// g++ -std=c++14
#include<bits/stdc++.h>
typedef long long int lli;
typedef long double lld;
using namespace std;

#define sd(x) scanf("%d",&x);
#define sd2(x,y) scanf("%d%d",&x,&y);
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z);

#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

#define LET(x, a)  __typeof(a) x(a)
#define foreach(it, v) for(LET(it, v.begin()); it != v.end(); it++)
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
int main(){
  _
  string s;
  cin >> s;
  int n = s.size();
  if(n==1){
    cout << "YES\n";
    cout << s << "\n";
    return 0;
  }
  int cnt = 0;
  int vis[n+1] = {0};
  char ans[n+1];
  for(int i=1;i<=n;i++){
    ans[i] = 'Z';
  }
  for(int i=2;2*i<=n;i++){
    if(vis[i]==0){
      for(int j=i;j<=n;j+=i){
        cnt += vis[j]==0?1:0;
        ans[j] = 'X';
        vis[j] = 1;
      }
    }
  }
  vector<pair<int,char> >vec(26);
  for(int i=0;i<26;i++){
    vec[i].fi = 0;
    vec[i].se = (char)'a'+i;
  }
  for(int i=0;i<n;i++){
    vec[s[i]-'a'].fi++;
  }
  sort(vec.begin(),vec.end(),greater<pair<int,char> >());
  if(vec[0].fi<cnt){
    cout << "NO\n";
    return 0;
  }
  for(int i=1;i<=n;i++){
    if(ans[i]=='X'){
      vec[0].fi--;
      ans[i] = vec[0].se;
    }
  }
  for(int i=1;i<=n;i++){
    if(ans[i]=='Z'){
      sort(vec.begin(),vec.end(),greater<pair<int,char> >());
      vec[0].fi--;
      ans[i] = vec[0].se;
    }
  }
  cout << "YES\n";
  for(int i=1;i<=n;i++){
    cout << ans[i];
  }
  cout << "\n";
  return 0;
}


// g++ -std=c++14
#include<bits/stdc++.h>
typedef long long int lli;
typedef long double lld;
using namespace std;

#define sd(x) scanf("%d",&x);
#define sd2(x,y) scanf("%d%d",&x,&y);
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z);

#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

#define LET(x, a)  __typeof(a) x(a)
#define foreach(it, v) for(LET(it, v.begin()); it != v.end(); it++)
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
string s;
vector<char>ans;
vector<pair<int,char> >cnt(26);
vector<int>vis(1001,0);
int main(){
  _
  for(int i=0;i<26;i++){
    cnt[i].se = (char)'a'+i;
    cnt[i].fi = 0;
  }
  cin >> s;
  ans.resize(s.size()+1);
  for(int i=1;i<ans.size();i++){
    ans[i] = 'X';
  }
  for(int i=0;i<s.size();i++){
    cnt[s[i]-'a'].fi++;
  }
  sort(cnt.begin(),cnt.end(),greater<pair<int,char> >());
  for(int i=2;i<=s.size();i++){
    if(i>2 and 2*i<=s.size() and vis[i]==0){
      for(int j=i;j<=s.size();j+=i){
        if(ans[j]=='X'){
          if(cnt[0].se!=ans[2]){
            cout << "NO\n";
            return 0;
          }
          ans[j] = ans[2];
          cnt[0].fi--;
          sort(cnt.begin(),cnt.end(),greater<pair<int,char> >());
        }
        vis[j] = i;
      }
    }
    else if(vis[i]==0){
      int q = (s.size())/i;
      if(cnt[0].fi<q){
        cout << "NO\n";
        return 0;
      }
      for(int j=i;j<=s.size();j+=i){
        vis[j] = i;
        cnt[0].fi--;
        ans[j] = cnt[0].se;
      }
    }
    sort(cnt.begin(),cnt.end(),greater<pair<int,char> >());
  }
  for(int i=1;i<ans.size();i++){
    if(ans[i]=='X'){
      sort(cnt.begin(),cnt.end(),greater<pair<int,char> >());
      ans[i] = cnt[0].se;
      cnt[0].fi--;
    }
  }
  cout << "YES\n";
  for(int i=1;i<ans.size();i++){
    cout << ans[i];
  }
  cout << "\n";
  return 0;
}


#include<bits/stdc++.h>
#define mem(dp,a) memset(dp,a,sizeof(dp))
#define pb(x) push_back(x)
#define m_p(x,y) make_pair(x,y)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,b,a) for (ll i=b;i>=a;i--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define pi acosl(-1.0l)
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fixed(n) fixed<<setprecision(n)
using namespace std;
typedef long long int ll;
typedef long double ld;
ll ESP=1e18;
ll FCB=1e9+7;
ll dir[][2]={{0,1},{0,-1},{1,0},{-1,0}};

const ll N=10000005;
bool prime[N];
set<ll>adj[20000];
vector<ll>vv;

void sieve()
{
 mem(prime,1);
 prime[1]=0;
 for(ll p=2;p*p<=N;p++)
 {
  if(prime[p])
  {
   for(ll j=p*p;j<=N;j+=p)
    prime[j]=0;
  }
 }
 for(ll i=2;i<=N;i++)
 {
  if(prime[i])
    vv.pb(i);
 }
}

int main()
{
 hs;
 sieve();
 string ss;
 cin>>ss;
 ll n=ss.length();
 char ch1[n+1];
 rep(i,1,n+1)
  ch1[i]=ss[i-1];
 if(n==1)
 {
  cout<<"NO"<<"\n";
  return 0;
 }

 ll last=2;
 for(ll i=0;i<vv.size();i++)
 {
  ll zz=vv[i];
  if(zz>n)
  {
   last=zz;
   break;
  }
  ll j=1;
  while(j<=n && j*zz<=n)
    adj[zz].insert(zz*j),j++;

 }
 ll lo=lower_bound(vv.begin(),vv.end(),last)-vv.begin();
 ll cnt=0;
 for(ll i=0;i<lo;i++)
 {
  if(vv[0]*vv[i+1]<=n)
    cnt++;
  else
    break;
 }
 for(ll i=1;i<=cnt;i++)
 {
  for(auto x:adj[vv[i]])
  {
   adj[2].insert(x);
  }
 }
 ll need=adj[2].size();
 map<char,ll>mp;
 char ch='#';
 for(ll i=1;i<=n;i++)
 {
   mp[ch1[i]]++;
   if(mp[ch1[i]]>=need)
        ch=ch1[i];
 }
 if(ch=='#')
  cout<<"NO"<<"\n";
 else
 {
  cout<<"YES"<<"\n";
  char ans[n+1];
  rep(i,0,n+1)
   ans[i]='#';
  for(auto xx:adj[2])
   ans[xx]=ch;
  ll cnt=0;
  vector<pair<char,ll>>vec;
  rep(i,1,n+1)
   vec.pb(m_p(ch1[i],i));
  ll idx=0;
  while(idx<n && cnt<need)
  {
   if(vec[idx].ff==ch)
    cnt++,vec[idx].ss=-1;
   idx++;
  }
  for(ll i=0;i<n;i++)
  {
   if(vec[i].ss!=-1)
   {
   for(ll j=1;j<=n;j++)
   {
    if(ans[j]=='#')
    {
       ans[j]=vec[i].ff;
       break;
    }
   }
   }
  }
  rep(i,1,n+1)
   cout<<ans[i];
  cout<<"\n";
 }
 return 0;
}


#include<bits/stdc++.h>
#define mem(dp,a) memset(dp,a,sizeof(dp))
#define pb(x) push_back(x)
#define m_p(x,y) make_pair(x,y)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,b,a) for (ll i=b;i>=a;i--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define pi acosl(-1.0l)
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fixed(n) fixed<<setprecision(n)
using namespace std;
typedef long long int ll;
typedef long double ld;
ll ESP=1e18;
ll FCB=1e9+7;
ll dir[][2]={{0,1},{0,-1},{1,0},{-1,0}};

const ll N=10000005;
bool prime[N];
set<ll>adj[20000];
vector<ll>vv;

void sieve()
{
 mem(prime,1);
 prime[1]=0;
 for(ll p=2;p*p<=N;p++)
 {
  if(prime[p])
  {
   for(ll j=p*p;j<=N;j+=p)
    prime[j]=0;
  }
 }
 for(ll i=2;i<=N;i++)
 {
  if(prime[i])
    vv.pb(i);
 }
}

int main()
{
 hs;
 sieve();
 string ss;
 cin>>ss;
 ll n=ss.length();
 char ch1[n+1];
 rep(i,1,n+1)
  ch1[i]=ss[i-1];
 if(n==1)
 {
  cout<<"YES"<<"\n";
  cout<<ss<<"\n";
  return 0;
 }

 ll last=2;
 for(ll i=0;i<vv.size();i++)
 {
  ll zz=vv[i];
  if(zz>n)
  {
   last=zz;
   break;
  }
  ll j=1;
  while(j<=n && j*zz<=n)
    adj[zz].insert(zz*j),j++;

 }
 ll lo=lower_bound(vv.begin(),vv.end(),last)-vv.begin();
 ll cnt=0;
 for(ll i=0;i<lo;i++)
 {
  if(vv[0]*vv[i+1]<=n)
    cnt++;
  else
    break;
 }
 for(ll i=1;i<=cnt;i++)
 {
  for(auto x:adj[vv[i]])
  {
   adj[2].insert(x);
  }
 }
 ll need=adj[2].size();
 map<char,ll>mp;
 char ch='#';
 for(ll i=1;i<=n;i++)
 {
   mp[ch1[i]]++;
   if(mp[ch1[i]]>=need)
        ch=ch1[i];
 }
 if(ch=='#')
  cout<<"NO"<<"\n";
 else
 {
  cout<<"YES"<<"\n";
  char ans[n+1];
  rep(i,0,n+1)
   ans[i]='#';
  for(auto xx:adj[2])
   ans[xx]=ch;
  ll cnt=0;
  vector<pair<char,ll>>vec;
  rep(i,1,n+1)
   vec.pb(m_p(ch1[i],i));
  ll idx=0;
  while(idx<n && cnt<need)
  {
   if(vec[idx].ff==ch)
    cnt++,vec[idx].ss=-1;
   idx++;
  }
  for(ll i=0;i<n;i++)
  {
   if(vec[i].ss!=-1)
   {
   for(ll j=1;j<=n;j++)
   {
    if(ans[j]=='#')
    {
       ans[j]=vec[i].ff;
       break;
    }
   }
   }
  }
  rep(i,1,n+1)
   cout<<ans[i];
  cout<<"\n";
 }
 return 0;
}


#include<bits/stdc++.h>
#define mem(dp,a) memset(dp,a,sizeof(dp))
#define pb(x) push_back(x)
#define m_p(x,y) make_pair(x,y)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,b,a) for (ll i=b;i>=a;i--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define pi acosl(-1.0l)
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fixed(n) fixed<<setprecision(n)
using namespace std;
typedef long long int ll;
typedef long double ld;
ll ESP=1e18;
ll FCB=1e9+7;
ll dir[][2]={{0,1},{0,-1},{1,0},{-1,0}};

const ll N=10000005;
bool prime[N];
set<ll>adj[20000];
vector<ll>vv;

void sieve()
{
 mem(prime,1);
 prime[1]=0;
 for(ll p=2;p*p<=N;p++)
 {
  if(prime[p])
  {
   for(ll j=p*p;j<=N;j+=p)
    prime[j]=0;
  }
 }
 for(ll i=2;i<=1000;i++)
 {
  if(prime[i])
    vv.pb(i);
 }
}

int main()
{
 hs;
 sieve();
 string ss;
 cin>>ss;
 ll n=ss.length();
 char ch1[n+1];
 rep(i,1,n+1)
  ch1[i]=ss[i-1];
 if(n==1)
 {
  cout<<"NO"<<"\n";
  return 0;
 }

 ll last=2;
 for(ll i=0;i<vv.size();i++)
 {
  ll zz=vv[i];
  if(zz>n)
  {
   last=zz;
   break;
  }
  ll j=1;
  while(j<=n && j*zz<=n)
    adj[zz].insert(zz*j),j++;

 }
 ll lo=lower_bound(vv.begin(),vv.end(),last)-vv.begin();
 ll cnt=0;
 for(ll i=0;i<lo;i++)
 {
  if(vv[0]*vv[i+1]<=n)
    cnt++;
  else
    break;
 }
 for(ll i=1;i<=cnt;i++)
 {
  for(auto x:adj[vv[i]])
  {
   adj[2].insert(x);
  }
 }
 ll need=adj[2].size();
 map<char,ll>mp;
 char ch='#';
 for(ll i=1;i<=n;i++)
 {
   mp[ch1[i]]++;
   if(mp[ch1[i]]>=need)
        ch=ch1[i];
 }
 if(ch=='#')
  cout<<"NO"<<"\n";
 else
 {
  cout<<"YES"<<"\n";
  char ans[n+1];
  rep(i,0,n+1)
   ans[i]='#';
  for(auto xx:adj[2])
   ans[xx]=ch;
  ll cnt=0;
  vector<pair<char,ll>>vec;
  rep(i,1,n+1)
   vec.pb(m_p(ch1[i],i));
  ll idx=0;
  while(idx<n && cnt<need)
  {
   if(vec[idx].ff==ch)
    cnt++,vec[idx].ss=-1;
   idx++;
  }
  for(ll i=0;i<n;i++)
  {
   if(vec[i].ss!=-1)
   {
   for(ll j=1;j<=n;j++)
   {
    if(ans[j]=='#')
    {
       ans[j]=vec[i].ff;
       break;
    }
   }
   }
  }
  rep(i,1,n+1)
   cout<<ans[i];
  cout<<"\n";
 }
 return 0;
}


#include<bits/stdc++.h>
#define mem(dp,a) memset(dp,a,sizeof(dp))
#define pb(x) push_back(x)
#define m_p(x,y) make_pair(x,y)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,b,a) for (ll i=b;i>=a;i--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define pi acosl(-1.0l)
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fixed(n) fixed<<setprecision(n)
using namespace std;
typedef long long int ll;
typedef long double ld;
ll ESP=1e18;
ll FCB=1e9+7;
ll dir[][2]={{0,1},{0,-1},{1,0},{-1,0}};

const ll N=10000005,N1=175;
bool prime[N];
set<ll>adj[N1];
vector<ll>vv;

void sieve()
{
 mem(prime,1);
 prime[1]=0;
 for(ll p=2;p*p<=N;p++)
 {
  if(prime[p])
  {
   for(ll j=p*p;j<=N;j+=p)
    prime[j]=0;
  }
 }
 for(ll i=2;i<=1000;i++)
 {
  if(prime[i])
    vv.pb(i);
 }
}

int main()
{
 hs;
 sieve();
 string ss;
 cin>>ss;
 ll n=ss.length();
 char ch1[n+1];
 rep(i,1,n+1)
  ch1[i]=ss[i-1];
 if(n==1)
 {
  cout<<"NO"<<"\n";
  return 0;
 }

 ll last=2;
 for(ll i=0;i<vv.size();i++)
 {
  ll zz=vv[i];
  if(zz>n)
  {
   last=zz;
   break;
  }
  ll j=1;
  while(j<=n && j*zz<=n)
    adj[zz].insert(zz*j),j++;

 }
 ll lo=lower_bound(vv.begin(),vv.end(),last)-vv.begin();
 ll cnt=0;
 for(ll i=0;i<lo;i++)
 {
  if(vv[0]*vv[i+1]<=n)
    cnt++;
  else
    break;
 }
 for(ll i=1;i<=cnt;i++)
 {
  for(auto x:adj[vv[i]])
  {
   adj[2].insert(x);
  }
 }
 ll need=adj[2].size();
 map<char,ll>mp;
 char ch='#';
 for(ll i=1;i<=n;i++)
 {
   mp[ch1[i]]++;
   if(mp[ch1[i]]>=need)
        ch=ch1[i];
 }
 if(ch=='#')
  cout<<"NO"<<"\n";
 else
 {
  cout<<"YES"<<"\n";
  char ans[n+1];
  rep(i,0,n+1)
   ans[i]='#';
  for(auto xx:adj[2])
   ans[xx]=ch;
  ll cnt=0;
  vector<pair<char,ll>>vec;
  rep(i,1,n+1)
   vec.pb(m_p(ch1[i],i));
  ll idx=0;
  while(idx<n && cnt<need)
  {
   if(vec[idx].ff==ch)
    cnt++,vec[idx].ss=-1;
   idx++;
  }
  for(ll i=0;i<n;i++)
  {
   if(vec[i].ss!=-1)
   {
   for(ll j=1;j<=n;j++)
   {
    if(ans[j]=='#')
    {
       ans[j]=vec[i].ff;
       break;
    }
   }
   }
  }
  rep(i,1,n+1)
   cout<<ans[i];
  cout<<"\n";
 }
 return 0;
}


#include<bits/stdc++.h>
#define mem(dp,a) memset(dp,a,sizeof(dp))
#define pb(x) push_back(x)
#define m_p(x,y) make_pair(x,y)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,b,a) for (ll i=b;i>=a;i--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define pi acosl(-1.0l)
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fixed(n) fixed<<setprecision(n)
using namespace std;
typedef long long int ll;
typedef long double ld;
ll ESP=1e18;
ll FCB=1e9+7;
ll dir[][2]={{0,1},{0,-1},{1,0},{-1,0}};

const ll N=1005,N1=170;
bool prime[N];
set<ll>adj[N1];
vector<ll>vv;

void sieve()
{
 mem(prime,1);
 prime[1]=0;
 for(ll p=2;p*p<=N;p++)
 {
  if(prime[p])
  {
   for(ll j=p*p;j<=N;j+=p)
    prime[j]=0;
  }
 }
 for(ll i=2;i<=1000;i++)
 {
  if(prime[i])
    vv.pb(i);
 }
}

int main()
{
 hs;
 sieve();
 string str;
 cin>>str;
 ll n=str.length();
 //cout<<n<<"\n";
 if(n==1)
 {
  cout<<"NO"<<"\n";
  return 0;
 }

 ll last=2;
 for(ll i=0;i<vv.size();i++)
 {
  ll zz=vv[i];
  if(zz>n)
  {
   last=zz;
   break;
  }
  ll j=1;
  while(j<=n && j*zz<=n)
    adj[zz].insert(zz*j),j++;

 }

 ll lo=lower_bound(vv.begin(),vv.end(),last)-vv.begin();
 /*for(ll i=0;i<lo;i++)
 {
  for(auto xx:adj[vv[i]])
    cout<<xx<<" ";
  cout<<"\n";
 }*/
 ll cnt=0;
 for(ll i=0;i<lo;i++)
 {
  if(vv[0]*vv[i+1]<=n)
    cnt++;
  else
    break;
 }

 for(ll i=1;i<=cnt;i++)
 {
  for(auto x:adj[vv[i]])
  {
   adj[2].insert(x);
  }
 }
 ll need=adj[2].size();
 /*for(auto x:adj[2])
    cout<<x<<" ";*/
 map<char,ll>mp;
 char ch='#';
 for(ll i=0;i<n;i++)
 {
   mp[str[i]]++;
   if(mp[str[i]]>=need)
        ch=str[i];
 }
 if(ch=='#')
  cout<<"NO"<<"\n";
 else
 {
  cout<<"YES"<<"\n";
  char ans[n];
  rep(i,0,n)
   ans[i]='#';
  for(auto xx:adj[2])
   ans[xx]=ch;
  ll cnt=0;
  vector<pair<char,ll>>vec;
  rep(i,0,n)
   vec.pb(m_p(str[i],i));
  ll idx=0;
  while(idx<n && cnt<need)
  {
   if(vec[idx].ff==ch)
    cnt++,vec[idx].ss=-1;
   idx++;
  }
  for(ll i=0;i<n;i++)
  {
   if(vec[i].ss!=-1)
   {
  // cout<<i<<"\n";
   for(ll j=0;j<n;j++)
   {
    if(ans[j]=='#')
    {
     //cout<<j<<"\n";
     ans[j]=vec[i].ff;
     break;
    }
   }
   }
  }
  rep(i,0,n)
   cout<<ans[i];
  cout<<"\n";
 }
 return 0;
}


#include<bits/stdc++.h>
#define mem(dp,a) memset(dp,a,sizeof(dp))
#define pb(x) push_back(x)
#define m_p(x,y) make_pair(x,y)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,b,a) for (ll i=b;i>=a;i--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define pi acosl(-1.0l)
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fixed(n) fixed<<setprecision(n)
using namespace std;
typedef long long int ll;
typedef long double ld;
ll ESP=1e18;
ll FCB=1e9+7;
ll dir[][2]={{0,1},{0,-1},{1,0},{-1,0}};

const ll N=10000005;
bool prime[N];
set<ll>adj[200];
vector<ll>vv;

void sieve()
{
 mem(prime,1);
 prime[1]=0;
 for(ll p=2;p*p<=N;p++)
 {
  if(prime[p])
  {
   for(ll j=p*p;j<=N;j+=p)
    prime[j]=0;
  }
 }
 for(ll i=2;i<=1000;i++)
 {
  if(prime[i])
    vv.pb(i);
 }
}

int main()
{
 hs;
 sieve();
 string ss;
 cin>>ss;
 ll n=ss.length();
 char ch1[n+1];
 rep(i,1,n+1)
  ch1[i]=ss[i-1];
 if(n==1)
 {
  cout<<"NO"<<"\n";
  return 0;
 }

 ll last=2;
 for(ll i=0;i<vv.size();i++)
 {
  ll zz=vv[i];
  if(zz>n)
  {
   last=zz;
   break;
  }
  ll j=1;
  while(j<=n && j*zz<=n)
    adj[zz].insert(zz*j),j++;

 }
 ll lo=lower_bound(vv.begin(),vv.end(),last)-vv.begin();
 ll cnt=0;
 for(ll i=0;i<lo;i++)
 {
  if(vv[0]*vv[i+1]<=n)
    cnt++;
  else
    break;
 }
 for(ll i=1;i<=cnt;i++)
 {
  for(auto x:adj[vv[i]])
  {
   adj[2].insert(x);
  }
 }
 ll need=adj[2].size();
 map<char,ll>mp;
 char ch='#';
 for(ll i=1;i<=n;i++)
 {
   mp[ch1[i]]++;
   if(mp[ch1[i]]>=need)
        ch=ch1[i];
 }
 if(ch=='#')
  cout<<"NO"<<"\n";
 else
 {
  cout<<"YES"<<"\n";
  char ans[n+1];
  rep(i,0,n+1)
   ans[i]='#';
  for(auto xx:adj[2])
   ans[xx]=ch;
  ll cnt=0;
  vector<pair<char,ll>>vec;
  rep(i,1,n+1)
   vec.pb(m_p(ch1[i],i));
  ll idx=0;
  while(idx<n && cnt<need)
  {
   if(vec[idx].ff==ch)
    cnt++,vec[idx].ss=-1;
   idx++;
  }
  for(ll i=0;i<n;i++)
  {
   if(vec[i].ss!=-1)
   {
   for(ll j=1;j<=n;j++)
   {
    if(ans[j]=='#')
    {
       ans[j]=vec[i].ff;
       break;
    }
   }
   }
  }
  rep(i,1,n+1)
   cout<<ans[i];
  cout<<"\n";
 }
 return 0;
}


#include <iostream>
#include <map>
#include <string.h>
#include <queue>

using namespace std;

int main(){
    string s;
    cin>>s;
    bool mark[s.size()+10];
    for(int i=0;i<s.size()+10;i++)
        mark[i]=false;
    int cnt=0;

    for(int i=2;i<=s.size()/2;i++){
        if(mark[s[i]]==false){
            for(int j=1;j*i<=s.size();j++){
                if(mark[i*j]==false){
                    mark[i*j]=true;
                    cnt++;
                }
            }
        }
    }

    map<char,int> mp;
    int mx=0;
    int charMx;
    for(int i=0;i<s.size();i++)
        mp[s[i]]=0;
    for(int i=0;i<s.size();i++){
        mp[s[i]]++;
        if(mx<mp[s[i]]){
            mx=mp[s[i]];
            charMx=s[i];
        }
    }

    queue<char> q;

    for(int i=0;i<s.size();i++)
    if(s[i]!=charMx){
        q.push(s[i]);
    }

    if (mx<cnt)
       return cout<<"NO"<<endl,0;

    cout<<"YES"<<endl;
    string result="";
    for(int i=0;i<s.size();i++){
        result+=charMx;
    }

    for(int i=1;i<=s.size();i++){
        if(q.empty())
            break;
        if(mark[i]==false){
            result[i-1]=q.front();
            q.pop();
        }

    }
    cout<<result<<endl;
    return 0;

}


#include <iostream>
#include <map>
#include <string.h>
#include <queue>

using namespace std;

int main(){
    string s;
    cin>>s;
    bool mark[s.size()+10];
    for(int i=0;i<s.size()+10;i++)
        mark[i]=false;
    int cnt=0;

    for(int i=2;i<=s.size()/2;i++){
        if(mark[s[i]]==false){
            for(int j=1;j*i<=s.size();j++){
                if(mark[i*j]==false){
                    mark[i*j]=true;
                    cnt++;
                }
            }
        }
    }

    map<char,int> mp;
    int mx=0;
    int charMx;
    for(int i=0;i<s.size();i++)
        mp[s[i]]=0;
    for(int i=0;i<s.size();i++){
        mp[s[i]]++;
        if(mx<mp[s[i]]){
            mx=mp[s[i]];
            charMx=s[i];
        }
    }

    queue<char> q;

    for(int i=0;i<s.size();i++)
    if(s[i]!=charMx){
        q.push(s[i]);
    }

    if (mx<cnt){
       return cout<<"NO"<<endl,0;
    }

    cout<<"YES"<<endl;
    string result="";
    for(int i=0;i<s.size();i++){
        result+=charMx;
    }

    for(int i=1;i<=s.size();i++){
        if(q.empty())
            break;
        if(mark[i]==false){
            result[i-1]=q.front();
            q.pop();
        }

    }
    cout<<cnt<<' '<<mx<<' '<<result<<endl;
    return 0;

}


#include <iostream>
#include <map>
#include <string.h>
#include <queue>

using namespace std;

int main(){
    string s;
    cin>>s;
    bool mark[s.size()+10];
    memset(mark,-1, sizeof mark);
    int cnt=0;

    for(int i=2;i<=s.size()/2;i++){
        if(mark[s[i]]==false){
            for(int j=1;j*i<=s.size();j++){
                if(mark[i*j]==false){
                    mark[i*j]=true;
                    cnt++;
                }
            }
        }
    }

    map<char,int> mp;
    int mx=0;
    int charMx;
    for(int i=0;i<s.size();i++){
        if(mp.find(s[i])!=mp.end())
            mp[s[i]]++;
        else
            mp[s[i]]=1;
        if(mx<mp[s[i]]){
            mx=mp[s[i]];
            charMx=s[i];
        }
    }

    queue<char> q;

    for(int i=0;i<s.size();i++)
    if(s[i]!=charMx){
        q.push(s[i]);
    }

    if (mx<cnt)
       return cout<<"NO"<<endl,0;

    cout<<"YES"<<endl;
    string result="";
    for(int i=0;i<s.size();i++){
        result+=charMx;
    }

    for(int i=1;i<=s.size();i++){
        if(q.empty())
            break;
        if(mark[i]==false){
            result[i-1]=q.front();
            q.pop();
        }

    }
    cout<<result<<endl;

}


#include <iostream>
#include <map>
#include <string.h>
#include <queue>

using namespace std;

int main(){
    string s;
    cin>>s;
    bool mark[s.size()+10];
    for(int i=0;i<s.size()+10;i++)
        mark[i]=false;
    int cnt=0;

    for(int i=2;i<=s.size()/2;i++){
        if(mark[i]==false){
            for(int j=1;j*i<=s.size();j++){
                if(mark[i*j]==false){
                    mark[i*j]=true;
                    cnt++;
                }
            }
        }
    }

    map<char,int> mp;
    int mx=0;
    char charMx;
    for(int i=0;i<s.size();i++)
        mp[s[i]]=0;
    for(int i=0;i<s.size();i++){
        mp[s[i]]++;
        if(mx<mp[s[i]]){
            mx=mp[s[i]];
            charMx=s[i];
        }
    }

    queue<char> q;

    for(int i=0;i<s.size();i++)
    if(s[i]!=charMx){
        q.push(s[i]);
    }

    if (mx<cnt){
       return cout<<"NO"<<endl,0;
    }

    cout<<"YES"<<endl;
    string result="";
    for(int i=0;i<s.size();i++){
        result+=charMx;
    }

    for(int i=1;i<=s.size();i++){
        if(q.empty())
            break;
        if(mark[i]==false){
            result[i-1]=q.front();
            q.pop();
        }

    }
    cout<<result<<endl;

    return 0;

}


#include <iostream>
#include <map>
#include <string.h>
#include <queue>

using namespace std;

int main(){
    string s;
    cin>>s;
    bool mark[s.size()+10];
    for(int i=0;i<s.size()+10;i++)
        mark[i]=false;
    int cnt=0;

    for(int i=2;i<=s.size()/2;i++){
        if(mark[s[i]]==false){
            for(int j=1;j*i<=s.size();j++){
                if(mark[i*j]==false){
                    mark[i*j]=true;
                    cnt++;
                }
            }
        }
    }

    map<char,int> mp;
    int mx=0;
    char charMx;
    for(int i=0;i<s.size();i++)
        mp[s[i]]=0;
    for(int i=0;i<s.size();i++){
        mp[s[i]]++;
        if(mx<mp[s[i]]){
            mx=mp[s[i]];
            charMx=s[i];
        }
    }

    queue<char> q;

    for(int i=0;i<s.size();i++)
    if(s[i]!=charMx){
        q.push(s[i]);
    }

    if (mx<cnt){
       return cout<<"NO"<<endl,0;
    }

    cout<<"YES"<<endl;
    string result="";
    for(int i=0;i<s.size();i++){
        result+=charMx;
    }

    for(int i=1;i<=s.size();i++){
        if(q.empty())
            break;
        if(mark[i]==false){
            result[i-1]=q.front();
            q.pop();
        }

    }
    cout<<result<<endl;

    return 0;

}


#include <iostream>
#include <map>
#include <string.h>
#include <queue>

using namespace std;

int main(){
    string s;
    cin>>s;
    bool mark[s.size()+10];
    memset(mark,false, sizeof mark);
    int cnt=0;

    for(int i=2;i<=s.size()/2;i++){
        if(mark[s[i]]==false){
            for(int j=1;j*i<=s.size();j++){
                if(mark[i*j]==false){
                    mark[i*j]=true;
                    cnt++;
                }
            }
        }
    }

    map<char,int> mp;
    int mx=0;
    int charMx;
    for(int i=0;i<s.size();i++){
        if(mp.find(s[i])!=mp.end())
            mp[s[i]]++;
        else
            mp[s[i]]=1;
        if(mx<mp[s[i]]){
            mx=mp[s[i]];
            charMx=s[i];
        }
    }

    queue<char> q;

    for(int i=0;i<s.size();i++)
    if(s[i]!=charMx){
        q.push(s[i]);
    }

    if (mx<cnt)
       return cout<<"NO"<<endl,0;

    cout<<"YES"<<endl;
    string result="";
    for(int i=0;i<s.size();i++){
        result+=charMx;
    }

    for(int i=1;i<=s.size();i++){
        if(q.empty())
            break;
        if(mark[i]==false){
            result[i-1]=q.front();
            q.pop();
        }

    }
    cout<<result<<endl;
    return 0;

}


#include <iostream>
#include <map>
#include <string.h>
#include <queue>

using namespace std;

int main(){
    string s;
    cin>>s;
    bool mark[s.size()+10];
    for(int i=0;i<s.size()+10;i++)
        mark[i]=false;
    int cnt=0;

    for(int i=2;i<=s.size()/2;i++){
        if(mark[s[i]]==false){
            for(int j=1;j*i<=s.size();j++){
                if(mark[i*j]==false){
                    mark[i*j]=true;
                    cnt++;
                }
            }
        }
    }

    map<char,int> mp;
    int mx=0;
    int charMx;
    for(int i=0;i<s.size();i++)
        mp[s[i]]=0;
    for(int i=0;i<s.size();i++){
        mp[s[i]]++;
        if(mx<mp[s[i]]){
            mx=mp[s[i]];
            charMx=s[i];
        }
    }

    queue<char> q;

    for(int i=0;i<s.size();i++)
    if(s[i]!=charMx){
        q.push(s[i]);
    }

    if (mx<cnt){
       return cout<<"NO"<<endl,0;
    }

    cout<<"YES"<<endl;
    string result="";
    for(int i=0;i<s.size();i++){
        result+=charMx;
    }

    for(int i=1;i<=s.size();i++){
        if(q.empty())
            break;
        if(mark[i]==false){
            result[i-1]=q.front();
            q.pop();
        }

    }
    cout<<result<<endl;
    if(s=="xxxjddyxduquybxdxx")
        cout<<cnt<<' '<<mx<<endl;
    return 0;

}


#include <iostream>
#include <map>
#include <string.h>
#include <queue>

using namespace std;

int main(){
    string s;
    cin>>s;
    bool mark[s.size()+10];
    memset(mark,false,sizeof mark);
    int cnt=0;

    for(int i=2;i<=s.size()/2;i++){
        if(mark[i]==false){
            for(int j=1;j*i<=s.size();j++){
                if(mark[i*j]==false){
                    mark[i*j]=true;
                    cnt++;
                }
            }
        }
    }

    map<char,int> mp;
    int mx=0;
    char charMx;
    for(int i=0;i<s.size();i++){
        if(mp.find(s[i])!=mp.end())
            mp[s[i]]++;
        else
            mp[s[i]]=1;
        if(mx<mp[s[i]]){
            mx=mp[s[i]];
            charMx=s[i];
        }
    }

    queue<char> q;

    for(int i=0;i<s.size();i++)
    if(s[i]!=charMx){
        q.push(s[i]);
    }

    if (mx<cnt){
       return cout<<"NO"<<endl,0;
    }

    cout<<"YES"<<endl;
    string result="";
    for(int i=0;i<s.size();i++){
        result+=charMx;
    }

    for(int i=1;i<=s.size();i++){
        if(q.empty())
            break;
        if(mark[i]==false){
            result[i-1]=q.front();
            q.pop();
        }

    }
    cout<<result<<endl;

    return 0;

}


#include <iostream>
#include <map>
#include <string.h>
#include <queue>

using namespace std;

int main(){
    string s;
    cin>>s;
    bool mark[s.size()+10];
    memset(mark,false, sizeof mark);
    int cnt=0;

    for(int i=2;i<=s.size()/2;i++){
        if(mark[s[i]]==false){
            for(int j=1;j*i<=s.size();j++){
                if(mark[i*j]==false){
                    mark[i*j]=true;
                    cnt++;
                }
            }
        }
    }

    map<char,int> mp;
    int mx=0;
    int charMx;
    for(int i=0;i<s.size();i++)
        mp[s[i]]=0;
    for(int i=0;i<s.size();i++){
        mp[s[i]]++;
        if(mx<mp[s[i]]){
            mx=mp[s[i]];
            charMx=s[i];
        }
    }

    queue<char> q;

    for(int i=0;i<s.size();i++)
    if(s[i]!=charMx){
        q.push(s[i]);
    }

    if (mx<cnt)
       return cout<<"NO"<<endl,0;

    cout<<"YES"<<endl;
    string result="";
    for(int i=0;i<s.size();i++){
        result+=charMx;
    }

    for(int i=1;i<=s.size();i++){
        if(q.empty())
            break;
        if(mark[i]==false){
            result[i-1]=q.front();
            q.pop();
        }

    }
    cout<<result<<endl;
    return 0;

}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e3 + 7;
string s;
char ans[N];
map<int,vector<int>> prime;
int vis[N];
map<char, int> mp;
void sieve(int n) {
    for (int i = 2; i <= n; ++i) {
        if (!vis[i]) {
            prime[i].push_back(i);
            int flag = 0;
            for (int j = i + i; j <= n; j += i) {
                if (vis[j]) {
                    flag = vis[j];
                    break;
                }
                prime[i].push_back(j);
                vis[j] = i;
            }
            if (flag) {
                prime[i].clear();
                for (int j = i; !vis[j]; j += i) {
                    prime[flag].push_back(j);
                }
            }
        }
    }
}
int main() {
    cin.sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> s;
    sieve(s.size());
    for (auto c : s)mp[c]++;
    for (auto g : prime) {
        /*cout << g.first << endl;
        for (int i = 0; i < g.second.size(); i++) {
            cout << g.second[i] << ' ';
        }puts("");*/
        if (!g.second.size())continue;
        int f = 0;
        for (auto &it : mp) {
            //cout <<it.first <<' ' <<  it.second << ' ' << g.second.size() << endl;
            if (it.second >= g.second.size()) {
                f = 1;
                for (int i = 0; i < g.second.size(); i++) {
                    ans[g.second[i]] = it.first;
                    it.second--;
                }
                break;
            }
        }
        if(!f)return puts("NO"), 0;
    }
    for (int i = 1; i <= s.size(); i++) {
        if (!isalpha(ans[i])) {
            int f = 0;
            for (auto& it : mp) {
                if (it.second) {
                    ans[i] = it.first;
                    it.second--;
                    f = 1;
                    break;
                }
            }
            if(!f)return puts("NO"), 0;
        }
    }

    puts("YES");
    for (int i = 1; i <= s.size(); i++) {
        cout << ans[i];
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e3 + 7;
string s;
char ans[N];
map<int,vector<int>> prime;
int vis[N];
map<char, int> mp;
void sieve(int n) {
    for (int i = 2; i <= n; ++i) {
        if (!vis[i]) {
            int flag = 0;
            for (int j = i; j <= n; j += i) {
                if (vis[j]) {
                    flag = vis[j];
                    break;
                }
                prime[i].push_back(j);
                vis[j] = i;
            }
            if (flag) {
                prime[i].clear();
                for (int j = i; j<=n; j += i) {
                    if (vis[j] == flag)continue;
                    prime[flag].push_back(j);
                    vis[j] = flag;
                }
            }
        }
    }
}
int main() {
    cin.sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> s;
    sieve(s.size());
    for (auto c : s)mp[c]++;
    for (auto g : prime) {
       /* for (int i = 0; i < g.second.size(); i++) {
            cout << g.second[i] << ' ';
        }puts("");*/
        if (!g.second.size())continue;
        int f = 0;
        for (auto &it : mp) {
            //cout <<it.first <<' ' <<  it.second << ' ' << g.second.size() << endl;
            if (it.second >= g.second.size()) {
                f = 1;
                for (int i = 0; i < g.second.size(); i++) {
                    ans[g.second[i]] = it.first;
                    it.second--;
                }
                break;
            }
        }
        if(!f)return puts("NO"), 0;
    }
    for (int i = 1; i <= s.size(); i++) {
        if (!isalpha(ans[i])) {
            int f = 0;
            for (auto& it : mp) {
                if (it.second) {
                    ans[i] = it.first;
                    it.second--;
                    f = 1;
                    break;
                }
            }
            if(!f)return puts("NO"), 0;
        }
    }

    printf("YES\n");
    for (int i = 1; i <= s.size(); i++) {
        printf("%c", ans[i]);
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e3 + 7;
string s;
char ans[N];
map<int,vector<int>> prime;
int vis[N];
map<char, int> mp;
void sieve(int n) {
    for (int i = 2; i <= n; ++i) {
        if (!vis[i]) {
            int flag = 0;
            for (int j = i; j <= n; j += i) {
                if (vis[j]) {
                    flag = vis[j];
                    break;
                }
                prime[i].push_back(j);
                vis[j] = i;
            }
            if (flag) {
                prime[i].clear();
                for (int j = i; j<=n; j += i) {
                    if (vis[j] != i)continue;
                    prime[flag].push_back(j);
                }
            }
        }
    }
}
int main() {
    cin.sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> s;
    sieve(s.size());
    for (auto c : s)mp[c]++;
    for (auto g : prime) {
       /* for (int i = 0; i < g.second.size(); i++) {
            cout << g.second[i] << ' ';
        }puts("");*/
        if (!g.second.size())continue;
        int f = 0;
        for (auto &it : mp) {
            //cout <<it.first <<' ' <<  it.second << ' ' << g.second.size() << endl;
            if (it.second >= g.second.size()) {
                f = 1;
                for (int i = 0; i < g.second.size(); i++) {
                    ans[g.second[i]] = it.first;
                    it.second--;
                }
                break;
            }
        }
        if(!f)return puts("NO"), 0;
    }
    for (int i = 1; i <= s.size(); i++) {
        if (!isalpha(ans[i])) {
            int f = 0;
            for (auto& it : mp) {
                if (it.second) {
                    ans[i] = it.first;
                    it.second--;
                    f = 1;
                    break;
                }
            }
            if(!f)return puts("NO"), 0;
        }
    }

    printf("YES\n");
    for (int i = 1; i <= s.size(); i++) {
        printf("%c", ans[i]);
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e3 + 7;
string s;
char ans[N];
map<int,vector<int>> prime;
int vis[N];
map<char, int> mp;
void sieve(int n) {
    for (int i = 2; i <= n; ++i) {
        if (!vis[i]) {
            prime[i].push_back(i);
            int flag = 0;
            for (int j = i + i; j <= n; j += i) {
                if (vis[j]) {
                    flag = vis[j];
                    break;
                }
                prime[i].push_back(j);
                vis[j] = i;
            }
            if (flag) {
                prime[i].clear();
                for (int j = i; !vis[j]; j += i) {
                    prime[flag].push_back(j);
                }
            }
        }
    }
}
int main() {
    cin.sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> s;
    sieve(s.size());
    for (auto c : s)mp[c]++;
    for (auto g : prime) {
        /*cout << g.first << endl;
        for (int i = 0; i < g.second.size(); i++) {
            cout << g.second[i] << ' ';
        }puts("");*/
        if (!g.second.size())continue;
        int f = 0;
        for (auto &it : mp) {
            //cout <<it.first <<' ' <<  it.second << ' ' << g.second.size() << endl;
            if (it.second >= g.second.size()) {
                f = 1;
                for (int i = 0; i < g.second.size(); i++) {
                    ans[g.second[i]] = it.first;
                    it.second--;
                }
                break;
            }
        }
        if(!f)return puts("NO"), 0;
    }
    for (int i = 1; i <= s.size(); i++) {
        if (!isalpha(ans[i])) {
            int f = 0;
            for (auto& it : mp) {
                if (it.second) {
                    ans[i] = it.first;
                    it.second--;
                    f = 1;
                    break;
                }
            }
            if(!f)return puts("NO"), 0;
        }
    }

    printf("YES\n");
    for (int i = 1; i <= s.size(); i++) {
        printf("%c", ans[i]);
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e3 + 7;
string s;
char ans[N];
map<int,vector<int>> prime;
int vis[N];
map<char, int> mp;
void sieve(int n) {
    for (int i = 2; i <= n; ++i) {
        if (!vis[i]) {
            prime[i].push_back(i);
            int flag = 0;
            for (int j = i + i; j <= n; j += i) {
                if (vis[j]) {
                    flag = vis[j];
                    break;
                }
                prime[i].push_back(j);
                vis[j] = i;
            }
            if (flag) {
                prime[i].clear();
                for (int j = i; j<=n; j += i) {
                    if (vis[j])continue;
                    prime[flag].push_back(j);
                }
            }
        }
    }
}
int main() {
    cin.sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> s;
    sieve(s.size());
    for (auto c : s)mp[c]++;
    for (auto g : prime) {
        /*for (int i = 0; i < g.second.size(); i++) {
            cout << g.second[i] << ' ';
        }puts("");*/
        if (!g.second.size())continue;
        int f = 0;
        for (auto &it : mp) {
            //cout <<it.first <<' ' <<  it.second << ' ' << g.second.size() << endl;
            if (it.second >= g.second.size()) {
                f = 1;
                for (int i = 0; i < g.second.size(); i++) {
                    ans[g.second[i]] = it.first;
                    it.second--;
                }
                break;
            }
        }
        if(!f)return puts("NO"), 0;
    }
    for (int i = 1; i <= s.size(); i++) {
        if (!isalpha(ans[i])) {
            int f = 0;
            for (auto& it : mp) {
                if (it.second) {
                    ans[i] = it.first;
                    it.second--;
                    f = 1;
                    break;
                }
            }
            if(!f)return puts("NO"), 0;
        }
    }

    printf("YES\n");
    for (int i = 1; i <= s.size(); i++) {
        printf("%c", ans[i]);
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
const int N = 1e5 + 7;
string s;
map<char, int> have;
map<int, vector<int>> need;
char ans[1005];
vector<int> prime;
int vis[1003];
map<int, int> mp;
void sieve(int n) {
    //cout << n << endl;
    for (int i = 2; i <= n; i++) {
        if (!vis[i]) {
            prime.push_back(i);
            //cout << i << endl;
            for (int j = i * i; j <= n; j += i)vis[j]++;
        }
    }
}
int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cin >> s;
    sieve(s.size());
    for (auto c : s)have[c]++;
    int cnt = 0;
    for (int i = 0; i < prime.size(); i++) {
        if (2 * prime[i] <= s.size()) {
            cnt += s.size() / prime[i];
        }
        else {
            break;
        }
    }
    int f = 0; char c = ' '; int mx = 0;
    for (auto it : have) {
        if (it.second >= cnt)f = 1;
        if (it.second > mx) {
            mx = it.second;
            c = it.first;
        }
    }
    if (!f)return puts("NO"), 0;
    for (int i = 0; i < prime.size() && cnt; i++) {
        //cout << prime[i] << endl;
        for (int j = 1; j < s.size()/prime[i] && cnt; j+=prime[i]) {
            //cout << prime[i] << ' ' << j;
            cnt--;
            ans[j] = c;
            have[c]--;
        }
    }
    cout << "YES\n";
    for (int i = 0; i < s.size(); i++) {
        //cout << isalpha(ans[i]);
        if (!isalpha(ans[i])) {
            for (auto &it : have) {
                //printf("%c %d\n", it.first, it.second);
                if (it.second) {
                    ans[i] = it.first;
                    it.second--;
                    break;
                }
            }
        }
    }
    for (int i = 0; i < s.size(); i++) {
        cout << ans[i];
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
const int N = 1e5 + 7;
string s;
map<char, int> have;
map<int, vector<int>> need;
char ans[1005];
vector<int> prime;
int vis[1003];
map<int, int> mp;
void sieve(int n) {
    //cout << n << endl;
    for (int i = 2; i <= n; i++) {
        if (!vis[i]) {
            prime.push_back(i);
            //cout << i << endl;
            for (int j = i * i; j <= n; j += i)vis[j]++;
        }
    }
}
int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cin >> s;
    sieve(s.size());
    for (auto c : s)have[c]++;
    int cnt = s.size() / 2;
    for (int i = 1; i < prime.size(); i++) {
        if (2 * prime[i] <= s.size()) {
            cnt++;
        }
        else {
            break;
        }
    }
    int f = 0; char c = ' '; int mx = 0;
    for (auto it : have) {
        if (it.second >= cnt)f = 1;
        if (it.second > mx) {
            mx = it.second;
            c = it.first;
        }
    }
    if (!f)return puts("NO"), 0;
    for (int i = 1; i * 2 < s.size() && cnt; i++) {
        cnt--;
        ans[i*2 - 1] = c;
        have[c]--;
        //cout << i * 2 << endl;
    }
    for (int i = 1; i < prime.size() && cnt; i++) {
        //cout << prime[i] << endl;
        cnt--;
        ans[prime[i] - 1] = c;
        have[c]--;
    }
    cout << "YES\n";
    for (int i = 0; i < s.size(); i++) {
        //cout << isalpha(ans[i]);
        if (!isalpha(ans[i])) {
            for (auto &it : have) {
                //printf("%c %d\n", it.first, it.second);
                if (it.second > 0) {
                    ans[i] = it.first;
                    it.second--;
                    break;
                }
            }
        }
    }
    for (int i = 0; i < s.size(); i++) {
        cout << ans[i];
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e3 + 7;
string s;
char ans[N];
map<int,vector<int>> prime;
int vis[N];
map<char, int> mp;
void sieve(int n) {
    for (int i = 2; i <= n; ++i) {
        if (!vis[i]) {
            prime[i].push_back(i);
            int flag = 0;
            for (int j = i + i; j <= n; j += i) {
                if (vis[j]) {
                    flag = vis[j];
                    break;
                }
                prime[i].push_back(j);
                vis[j] = i;
            }
            if (flag) {
                prime[i].clear();
                for (int j = i; !vis[j]; j += i) {
                    prime[flag].push_back(j);
                }
            }
        }
    }
}
int main() {
    cin.sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> s;
    sieve(s.size());
    for (auto c : s)mp[c]++;
    for (auto g : prime) {
        /*cout << g.first << endl;
        for (int i = 0; i < g.second.size(); i++) {
            cout << g.second[i] << ' ';
        }puts("");*/
        if (!g.second.size())continue;
        int f = 0;
        for (auto &it : mp) {
            //cout <<it.first <<' ' <<  it.second << ' ' << g.second.size() << endl;
            if (it.second >= g.second.size()) {
                f = 1;
                for (int i = 0; i < g.second.size(); i++) {
                    ans[g.second[i]] = it.first;
                    it.second--;
                }
                break;
            }
        }
        if(!f)return puts("NO"), 0;
    }
    for (int i = 1; i <= s.size(); i++) {
        if (!isalpha(ans[i])) {
            int f = 0;
            for (auto& it : mp) {
                if (it.second) {
                    ans[i] = it.first;
                    it.second--;
                    f = 1;
                    break;
                }
            }
            if(!f)return puts("NO"), 0;
        }
    }

    printf("YES");
    for (int i = 1; i <= s.size(); i++) {
        cout << ans[i];
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e3 + 7;
string s;
char ans[N];
map<int,vector<int>> prime;
int vis[N];
map<char, int> mp;
void sieve(int n) {
    for (int i = 2; i <= n; ++i) {
        if (!vis[i]) {
            prime[i].push_back(i);
            int flag = 0;
            for (int j = i + i; j <= n; j += i) {
                if (vis[j]) {
                    flag = vis[j];
                    break;
                }
                prime[i].push_back(j);
                vis[j] = i;
            }
            if (flag) {
                prime[i].clear();
                for (int j = i; !vis[j]; j += i) {
                    prime[flag].push_back(j);
                }
            }
        }
    }
}
int main() {
    //cin.sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> s;
    sieve(s.size());
    for (auto c : s)mp[c]++;
    for (auto g : prime) {
        /*cout << g.first << endl;
        for (int i = 0; i < g.second.size(); i++) {
            cout << g.second[i] << ' ';
        }puts("");*/
        if (!g.second.size())continue;
        int f = 0;
        for (auto &it : mp) {
            //cout <<it.first <<' ' <<  it.second << ' ' << g.second.size() << endl;
            if (it.second >= g.second.size()) {
                f = 1;
                for (int i = 0; i < g.second.size(); i++) {
                    ans[g.second[i]] = it.first;
                    it.second--;
                }
                break;
            }
        }
        if(!f)return puts("NO"), 0;
    }
    for (int i = 1; i <= s.size(); i++) {
        if (!isalpha(ans[i])) {
            int f = 0;
            for (auto& it : mp) {
                if (it.second) {
                    ans[i] = it.first;
                    it.second--;
                    f = 1;
                    break;
                }
            }
            if(!f)return puts("NO"), 0;
        }
    }

    puts("YES");
    for (int i = 1; i <= s.size(); i++) {
        cout << ans[i];
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
const int N = 1e5 + 7;
string s;
map<char, int> have;
map<int, vector<int>> need;
char ans[1005];
vector<int> prime;
int vis[1003];
map<int, int> mp;
void sieve(int n) {
    //cout << n << endl;
    for (int i = 2; i <= n; i++) {
        if (!vis[i]) {
            prime.push_back(i);
            //cout << i << endl;
            for (int j = i * i; j <= n; j += i)vis[j]++;
        }
    }
}
int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cin >> s;
    sieve(s.size());
    for (auto c : s)have[c]++;
    int cnt = 0;
    for (int i = 0; i < prime.size(); i++) {
        if (2 * prime[i] <= s.size()) {
            cnt += s.size() / prime[i];
        }
        else {
            break;
        }
    }
    int f = 0; char c = ' '; int mx = 0;
    for (auto it : have) {
        if (it.second >= cnt)f = 1;
        if (it.second > mx) {
            mx = it.second;
            c = it.first;
        }
    }
    if (!f)return puts("NO"), 0;
    for (int i = 0; i < prime.size() && cnt; i++) {
        //cout << prime[i] << endl;
        for (int j = 1; j < s.size()/prime[i] && cnt; j+=prime[i]) {
            //cout << prime[i] << ' ' << j;
            cnt--;
            ans[j] = c;
            have[c]--;
        }
    }
    puts("YES");
    for (int i = 0; i < s.size(); i++) {
        //cout << isalpha(ans[i]);
        if (!isalpha(ans[i])) {
            for (auto &it : have) {
                //printf("%c %d\n", it.first, it.second);
                if (it.second) {
                    ans[i] = it.first;
                    it.second--;
                    break;
                }
            }
        }
    }
    for (int i = 0; i < s.size(); i++) {
        cout << ans[i];
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e3 + 7;
string s;
char ans[N];
map<int,vector<int>> prime;
int vis[N];
map<char, int> mp;
void sieve(int n) {
    for (int i = 2; i <= n; ++i) {
        if (!vis[i]) {
            prime[i].push_back(i);
            int flag = 0;
            for (int j = i + i; j <= n; j += i) {
                if (vis[j]) {
                    flag = vis[j];
                    break;
                }
                prime[i].push_back(j);
                vis[j] = i;
            }
            if (flag) {
                prime[i].clear();
                for (int j = i; j<=n; j += i) {
                    prime[flag].push_back(j);
                }
            }
        }
    }
}
int main() {
    cin.sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> s;
    sieve(s.size());
    for (auto c : s)mp[c]++;
    for (auto g : prime) {
        /*cout << g.first << endl;
        for (int i = 0; i < g.second.size(); i++) {
            cout << g.second[i] << ' ';
        }puts("");*/
        if (!g.second.size())continue;
        int f = 0;
        for (auto &it : mp) {
            //cout <<it.first <<' ' <<  it.second << ' ' << g.second.size() << endl;
            if (it.second >= g.second.size()) {
                f = 1;
                for (int i = 0; i < g.second.size(); i++) {
                    ans[g.second[i]] = it.first;
                    it.second--;
                }
                break;
            }
        }
        if(!f)return puts("NO"), 0;
    }
    for (int i = 1; i <= s.size(); i++) {
        if (!isalpha(ans[i])) {
            int f = 0;
            for (auto& it : mp) {
                if (it.second) {
                    ans[i] = it.first;
                    it.second--;
                    f = 1;
                    break;
                }
            }
            if(!f)return puts("NO"), 0;
        }
    }

    printf("YES\n");
    for (int i = 1; i <= s.size(); i++) {
        printf("%c", ans[i]);
    }
    return 0;
}


import java.util.*;
import java.io.*;

public class Main implements Runnable {

	public void solve() throws IOException {
		char[] c = nextToken().toCharArray();

                int N = c.length;
                boolean[] mixed = new boolean[N+1];
                for(int i = 2; i <= N; i++){
                    boolean  prime = true;
                    for(int j = 2; j * j <= i; j++) if(i % j == 0) prime = false;
                    if(prime && i * 2 <= N){
                        for(int j = i; j <= N; j += i) mixed[j] = true;
                    }
                }

                int countMixed = 0;
                for(int i = 0; i < mixed.length; i++) if(mixed[i]) countMixed++;

                int[] count = new int[26];
                for(char cc : c) count[cc - 'a']++;

                char[] answer = new char[N];
                for(int i = 0; i < 26; i++){
                    if(count[i] >= countMixed){
                        for(int j = 0; j < N; j++) if(mixed[j + 1]){
                            answer[j] = (char)('a' + i);
                            count[i]--;
                        }

                        for(int j = 0; j < N; j++) if(!mixed[j+1]){
                            for(int k = 0; k < 26; k++){
                                if(count[k] > 0){
                                    answer[j] = (char)('a' + k);
                                    count[k]--;
                                    break;
                                }
                            }

                        }

                        out.println("YES");
                        out.println(new String(answer));
                        return;
                    }
                }

                out.println("NO");
	}

	//-----------------------------------------------------------
	public static void main(String[] args) {
		new Main().run();
	}

        public void debug(Object... arr){
            System.out.println(Arrays.deepToString(arr));
        }

        public void print1Int(int[] a){
                for(int i = 0; i < a.length; i++)
                        System.out.print(a[i] + " ");
                System.out.println();
        }

        public void print2Int(int[][] a){
                for(int i = 0; i < a.length; i++){
                        for(int j = 0; j < a[0].length; j++){
                                System.out.print(a[i][j] + " ");
                        }
                        System.out.println();
                }
        }

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
                        out = new PrintWriter(System.out);
			tok = null;
			solve();
			in.close();
                        out.close();
		} catch (IOException e) {
			System.exit(0);
		}
	}

	public String nextToken() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
        PrintWriter out;
	BufferedReader in;
	StringTokenizer tok;
}


import java.util.*;
public class Main {
static char ans[];
static boolean used[];
static ArrayList<Integer>primes;
public static void fill(char a,int len){
	for(int i=2;i<=len;i++){
		if(check(i,len))continue;
		ans[i]=a;
		used[i]=true;
	}
}
static boolean check(int a,int len){
	for(int c:primes){
		if(c > len/2 && c == a)
			return true;
	}
	return false;
}
public static void main(String [] args){
	Scanner in=new Scanner(System.in);
	String s=in.next();
	int array[]=new int[26];
	for(int i=0;i<s.length();i++)
		array[s.charAt(i)-'a']++;
		boolean isPrime[]=new boolean[1001];
		Arrays.fill(isPrime,true);
		primes=new ArrayList<Integer>();
	for(int i=2;i<=1000;i++){
		if(!isPrime[i])continue;
		primes.add(i);
		for(int j=i+i;j<=1000;j+=i){
			isPrime[j]=false;
		}
	}
	int len=s.length();
	ans=new char[len+1];
	used=new boolean[len+1];
	int t=0;
	for(int a:primes){
		if(a > len)break;
		if(a > len/2)t++;
	}
	t++;
	for(int i=0;i<26;i++){
		if(array[i] >= len-t){
			fill((char)(i+97),len);
			array[i]-=(len-t);
			break;
		}
		if(i==25){
			System.out.print("NO");
			return;
		}
	}
	int ptr=1;
	//for(int i=1;i<=len;i++)System.out.println(i+" "+ans[i]);
	for(int j=0;j<26;j++){
	if(array[j]==0)continue;
	int cnt=array[j];
	//System.out.println(cnt+" "+(char)(j+97));
	for(int i=1;i<=cnt;i++){
	while(ptr <=len && used[ptr])ptr++;
	used[ptr]=true;
	ans[ptr]=(char)(j+97);
	}
}
StringBuilder sb=new StringBuilder("YES");
sb.append('\n');
for(int i=1;i<=len;i++)
sb.append(ans[i]);
System.out.print(sb);
}
}


import java.util.*;
public class Main {
static char ans[];
static boolean used[];
public static void fill(char a,int len,int prime){
	for(int i=prime;i<=len;i+=prime){
		ans[i]=a;used[i]=true;
	}
}
public static void main(String [] args){
	Scanner in=new Scanner(System.in);
	String s=in.next();
	int array[]=new int[26];
	for(int i=0;i<s.length();i++)
		array[s.charAt(i)-'a']++;
		boolean isPrime[]=new boolean[1001];
		Arrays.fill(isPrime,true);
		ArrayList<Integer>primes=new ArrayList<Integer>();
	for(int i=2;i<=1000;i++){
		if(!isPrime[i])continue;
		primes.add(i);
		for(int j=i+i;j<=1000;j++){
			isPrime[j]=false;
		}
	}
	int len=s.length();
	ans=new char[len+1];
	used=new boolean[len+1];
	for(int a:primes){
		int times=len/a;
		for(int j=0;j<26;j++){
			if(array[j] >= times){
				fill((char)(j+97),len,a);
				array[j]-=times;
				break;
			}
			if(j==25){
				System.out.print("NO");
				return;
			}
		}
	}
	int ptr=1;
	for(int j=0;j<26;j++){
	if(array[j]==0)continue;
	int cnt=array[j];
	for(int i=1;i<=cnt;i++){
	while(ptr <=len && used[ptr])ptr++;
	used[ptr]=true;
	ans[ptr]=(char)(j+97);
	}
}
StringBuilder sb=new StringBuilder("YES");
sb.append('\n');
for(int i=1;i<=len;i++)
sb.append(ans[i]);
System.out.print(sb);
}
}


import java.io.*;
import java.util.*;

import java.math.*;
public class Main3 {
	public static class Node implements Comparable<Node>
	{
		char a;
		int count;
		public Node(char a, int count)
		{
			this.count = count;
			this.a = a;
		}
		@Override
		public int compareTo(Node o) {
			// TODO Auto-generated method stub
			return new Integer(count).compareTo(o.count);
		}
		@Override
		public String toString()
		{
			return a+" "+count;
		}
	}
public static void main(String[] args) throws IOException {
	File file = new File("in");
	BufferedReader in;
	if (file.exists()) {
		in = new BufferedReader(new FileReader(file));
	} else {
		in = new BufferedReader(new InputStreamReader(System.in));
	}
	String line, lines[];
	char arr[] = in.readLine().toCharArray();
	ArrayList<Integer> primes = numerosPrimos(arr.length+1);
	int p;
	int l = arr.length;
	int sum = 1;
	int r;
	int ps[] = new int[1001];
	ps[1] = 1;
	for( int i = 0; i < primes.size(); i++ )
	{
		p = primes.get(i);
		//System.out.println(p+" "+ l/p);
		if ( l/p == 1)
		{
			sum++;
			ps[sum] = p;
		}
	}
	r = l - sum;
	//System.out.println(r);
	//System.out.println(primes.size());

	int count[] = new int[30];
	for ( int i = 0; i < arr.length; i++ )
	{
		count[arr[i]-'a']++;
	}
	Node arrN[] = new Node[26];
	int m = 26;
	for( int i = 'a'; i <= 'z'; i++ )
	{
		arrN[i-'a'] = new Node((char)i, count[i-'a']);
	}
	Arrays.sort(arrN);

	if( arrN[arrN.length-1].count < r)
	{
		System.out.println("NO");
	}
	else
	{
		int intV;
		char charV;
		Queue<Character> list = new LinkedList<Character>();
		for( int i = 0; i< arrN.length; i++ )
		{

			intV = arrN[i].count;
			charV = arrN[i].a;
			for( int j = 0; j < intV; j++ ) list.add(charV);
		}
		int index = 0;
		char result[] = new char[arr.length];
		Arrays.fill(result, 'A');
		for( int i = 1; i <= sum; i++ )
		{
			result[ps[i]-1] = list.poll();
		}
		for( int i = 0; i < result.length; i++ )
		{
			if ( result[i] == 'A' )
			{
				result[i] = arrN[arrN.length-1].a;
			}
		}
		System.out.println("YES");
		System.out.println(result);
	}

}

public static ArrayList<Integer> numerosPrimos(int n) {
	if (n < 2)  return new ArrayList<Integer>();
	char[] is_composite = new char[(n - 2 >> 5) + 1];
	final int limit_i = n - 2 >> 1, limit_j = 2 * limit_i + 3;
	ArrayList<Integer> results = new ArrayList<>((int) Math.ceil(1.25506	* n / Math.log(n)));
	results.add(2);
	for (int i = 0; i < limit_i; ++i)
		if ((is_composite[i >> 4] & 1 << (i & 0xF)) == 0) {
			results.add(2 * i + 3);
			for (long j = 4L * i * i + 12L * i + 9; j < limit_j; j += 4 * i + 6)
				is_composite[(int) (j - 3L >> 5)] |= 1 << (j - 3L >> 1 & 0xF);
		}
	return results;
}

public static int[] readInts(String line) {
	String lines[] = line.split("\\s+");
	int[] result = new int[line.length()];
	for (int i = 0; i < lines.length; i++)
		result[i] = Integer.parseInt(lines[i]);
	return result;
}
}


import java.io.*;
import java.util.*;

public class Pr123A {
	public static void main(String[] args) throws IOException {
		new Pr123A().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out, true);
		solve();
		out.flush();
	}

	void solve() throws IOException {
		char[] s = nextToken().toCharArray();
		int[] col = new int[s.length + 1];
		boolean[] isPrime = new boolean[s.length + 1];
		boolean[] vis = new boolean[s.length + 1];
		Arrays.fill(isPrime, true);
		int cnt = 0;
		for (int i = 1; i < s.length; i++) {
			int p = i + 1;
			if (isPrime[p]) {
				vis[p] = true;
				for (int j = 2; j <= s.length / p; j++) {
					isPrime[j * p] = false;
					if (!vis[p * j]) {
						cnt++;
						vis[p * j] = true;
					}
					col[p]++;
				}
				if (col[p] > 0) {
					cnt++;
				}
			}
		}
		Arrays.sort(s);
		int[] howOft = new int[26];
		char[] ans = new char[s.length];
		char isn = ans[0];
		int isc = 0;
		boolean flag = false;
		for (int i = 0; i < s.length; i++) {
			howOft[(int) (s[i] - 'a')]++;
			if (howOft[(int) (s[i] - 'a')] >= cnt) {
				isc = i;
				flag = true;
			}
		}
		if (!flag) {
			out.println("NO");
			return;
		}
		out.println("YES");
		for (int i = 0; i < s.length; i++) {
			if (isPrime[i + 1] && col[i + 1] > 0) {
				ans[i] = s[isc];
				howOft[(int) (s[isc] - 'a')]--;
			} else if (!isPrime[i + 1]) {
				ans[i] = s[isc];
				howOft[(int) (s[isc] - 'a')]--;
			}
		}
		int sch = 0;
		for (int i = 0; i < 26; i++) {
			while (howOft[i] > 0) {
				while (ans[sch] != isn) {
					sch++;
				}
				ans[sch] = (char) (i + 'a');
				howOft[i]--;
			}
		}
		for (int i = 0; i < s.length; i++) {
			out.print(ans[i]);
		}
	}
}


import java.io.*;
import java.util.*;

public class PrimePermutation {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        String str = f.readLine();
        int n = str.length();
        char[] a = new char[n];
        for (int i = 0; i < n; i++)
            a[i] = str.charAt(i);
        Arrays.sort(a);

        int[] primes = {2,3,5,7,11,13,17,19,23,29,31,37};
        boolean[] b = new boolean[n];
        int count = 0;
        for (int i = 2; i <= n; i++)
        {
            int j = 0;
            while (i%primes[j] != 0 && primes[j]*primes[j] <= i)
                j++;
            int p = primes[j];
            if (i % p != 0)
                p = i;
            if (p <= n/2)
            {
                b[i-1] = true;
                count++;
            }
        }

        int index = 0;
        int max = 0;
        int len = 1;
        for (int i = 1; i < n; i++)
            if (a[i] == a[i-1])
                len++;
            else
            {
                if (len > max)
                {
                    index = i-1;
                    max = len;
                }
                len = 1;
            }
        if (len > max)
        {
            index = n-1;
            max = len;
        }

        if (max < count)
        {
            System.out.println("NO");
            return;
        }
        System.out.println("YES");

        char c = a[index];
        for (int i = 0; i < n; i++)
            if (b[i])
                System.out.print(c);
            else
                System.out.print(a[(++index)%n]);

    }
}