#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int maxn = 10000;
char a[maxn];
int vis[maxn];
int vis2[maxn];
int main() {
  int m, n, i, j, k, flag = 1;
  cin >> n;
  cin >> a;
  for (int i = 0; i < n; i++) {
    vis[i] = -1;
    vis2[i] = -1;
  }
  for (int i = 0; i < n; i++) {
    int d = i, t;
    for (j = i; j >= 0; j--) {
      if (a[d] < a[j]) {
        vis2[i] = 1;
        t = vis[d];
        vis[d] = 1;
        if (t != vis[d] && t != -1) {
          flag = 0;
          break;
        }
        for (k = d - 1; k >= j; k--) {
          t = vis[k];
          vis[k] = 0;
          if (t != vis[k] && t != -1) {
            flag = 0;
            break;
          }
          t = vis2[k];
          if (t == -1) vis[k] = 0;
          swap(a[d], a[k]);
          swap(vis[d], vis[k]);
        }
        d = j;
      }
    }
  }
  if (flag) {
    cout << "YES\n";
    for (i = 0; i < n; i++) {
      if (vis2[i] == -1) vis2[i] = 0;
      printf("%d", vis2[i]);
    }
    cout << "\n";
  } else
    cout << "NO\n";
  return 0;
}
