[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
declare prime with integer x as argument, returning integer
    for i = 2 to x exclusive
        if x % i is 0, return false from function
    end of the block
    return true from function
end of the block
define the main function
    create string s
    read s
    create integer comp with comp = length of s - 1
    for i = 2 to length of s inclusive
        if 2 * i is greater than length of s and result of run prime with i as argument, decrement comp
    end of the block
    create integer vector letters initialized with 26, 0
    for i = 0 to length of s exclusive, increment letter[s[i] - 'a' ]
    create boolean ok with ok = false
    create integer let
    for i = 0 to 26 exclusive
        if letters[i] is greater than or equal to comp
            set let to i, set ok to true
            break loop
        end of the block
    end of the block
    create integer cur with cur = 0
    if not ok
        print "NO\n"
        return to indicate successful execution
    end of the block
    decrement letters[let] by comp
    print "YES\n"
    create string t with t = ""
    for i = 1 to length of s inclusive
        if i is 1 or ( 2 * i is greater than length of s and result of run prime with i as argument )
            while letters[cur] is 0, increment cur
            increment to by character casted ( 'a' + cur )
            decrement letters[cur]
        else
            increment t by character casted ( 'a' + let )
        end of the block
    end of the block
    print t print newline
    return to indicate successful execution
end of the block

[CODE]:

int prime(int x) {
    for (int i = 2; i < x; i++) {
        if (x % i == 0) return false;
    }
    return true;
}
int main() {
    string s;
    cin >> s;
    int comp = s.length() - 1;
    for (int i = 2; i <= s.length(); i++) {
        if (2 * i > s.length() && prime(i)) comp--;
    }
    vector<int> letters(26, 0);
    for (size_t i = 0; i < s.length(); i++) { ++letters[s[i] - 'a']; }
    bool ok = false;
    int let;
    for (int i = 0; i < 26; i++) {
        if (letters[i] >= comp) {
            let = i, ok = true;
            break;
        }
    }
    int cur = 0;
    if (!ok) {
        cout << "NO\n";
        return 0;
    }
    letters[let] -= comp;
    cout << "YES\n";
    string t = "";
    for (int i = 1; i <= s.length(); i++) {
        if (i == 1 || (2 * i > s.length() && prime(i))) {
            while (letters[cur] == 0) cur++;
            t += (char)('a' + cur);
            --letters[cur];
        } else {
            t += (char)('a' + let);
        }
    }
    cout << t << endl;
    return 0;
}