#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 2 * 1e9 + 7;
const int base = 2e5 + 1;
const int MAX = 1e5 + 2;
const double EPS = 1e-9;
const double PI = acos(-1.);
const int MAXN = 2 * 1e6 + 1;
int main() {
  int n;
  cin >> n;
  char cur = 'a';
  cur--;
  char maxi = 'a';
  string s;
  for (int i = (0); i < (n); ++i) {
    char k;
    cin >> k;
    if (k >= maxi) {
      maxi = k;
      s += '0';
    } else {
      if (k < cur) {
        cout << "NO";
        return 0;
      }
      s += '1';
      cur = k;
    }
  }
  cout << "YES\n" << s;
  return 0;
}
