#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 2e3 + 100;
const int INF = 0x3f3f3f3f;
inline long long fpow(long long a, long long b) {
  long long r = 1, t = a;
  while (b) {
    if (b & 1) r = (r * t) % MOD;
    b >>= 1;
    t = (t * t) % MOD;
  }
  return r;
}
vector<int> G[MAXN << 1];
char str[MAXN];
int color[MAXN], n;
bool flag = true;
void bfs(int x) {
  queue<int> q;
  q.push(x);
  color[x] = 1;
  while (!q.empty()) {
    int ans = q.front();
    q.pop();
    for (auto it : G[ans]) {
      if (!color[it]) {
        if (color[ans] == 1)
          color[it] = 2;
        else
          color[it] = 1;
        q.push(it);
      } else if (color[it] == color[ans]) {
        flag = false;
        return;
      }
    }
  }
}
int main() {
  scanf("%d%s", &n, str + 1);
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (str[i] > str[j]) G[i].push_back(j), G[j].push_back(i);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (!flag) break;
    if (!color[i]) bfs(i);
  }
  if (!flag)
    printf("NO\n");
  else {
    printf("YES\n");
    for (int i = 1; i <= n; i++) {
      if (color[i] == 1)
        printf("0");
      else
        printf("1");
    }
    cout << endl;
  }
  return 0;
}
