#include <bits/stdc++.h>
using namespace std;
const int p = 1000000007;
long long int factorialmod(long long int n) {
  long long int fact = 1;
  for (long long int i = 1; i <= n; i++) fact = (fact * i) % p;
  fact = fact % p;
  return fact;
}
long long int factorial(long long int n) {
  long long int fact = 1;
  for (long long int i = 1; i <= n; i++) fact = (fact * i);
  return fact;
}
long long int powermod(long long int a, long long int b, long long int p) {
  a = a % p;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % p;
    a = a * a % p;
    b >>= 1;
  }
  return res;
}
long long int power(long long int a, long long int b) {
  a = a;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a);
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long int modInverse(long long int x) { return power(x, p - 2); }
long long int nCi(long long int n, long long int i, long long int fact[]) {
  if (n < i) return 0;
  if (i == 0) return 1;
  return (fact[n] % p * modInverse(fact[i]) % p * modInverse(fact[n - i]) % p) %
         p;
}
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
long long int exgcd(long long int a, long long int b, long long int &x,
                    long long int &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long int x1, y1;
  long long int d = exgcd(b, a % b, x1, y1);
  x = y1;
  y = x1 - y1 * (a / b);
  return d;
}
bool find_any_dio_solution(long long int a, long long int b, long long int c,
                           long long int &x0, long long int &y0,
                           long long int &g) {
  g = exgcd(abs(a), abs(b), x0, y0);
  if (c % g) {
    return false;
  }
  x0 *= c / g;
  y0 *= c / g;
  if (a < 0) x0 = -x0;
  if (b < 0) y0 = -y0;
  return true;
}
void matmultiply(long long int F[2][2], long long int M[2][2]) {
  long long int x = (F[0][0] * M[0][0] % p + F[0][1] * M[1][0] % p) % p;
  long long int y = (F[0][0] * M[0][1] % p + F[0][1] * M[1][1] % p) % p;
  long long int z = (F[1][0] * M[0][0] % p + F[1][1] * M[1][0] % p) % p;
  long long int w = (F[1][0] * M[0][1] % p + F[1][1] * M[1][1] % p) % p;
  F[0][0] = x;
  F[0][1] = y;
  F[1][0] = z;
  F[1][1] = w;
}
void matpower(long long int F[2][2], long long int n) {
  if (n == 0 || n == 1) return;
  long long int M[2][2] = {{1, 1}, {1, 0}};
  matpower(F, n / 2);
  matmultiply(F, F);
  if (n % 2 != 0) matmultiply(F, M);
}
long long int fib(long long int n) {
  long long int F[2][2] = {{1, 1}, {1, 0}};
  if (n == 0) return 0;
  matpower(F, n - 1);
  return F[0][0] % p;
}
bool miller_rabin(int64_t N) {
  if (N < 2) {
    return false;
  }
  for (long long int p : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}) {
    if (N % p == 0) {
      return N == p;
    }
  }
  long long int R = __builtin_ctz(N - 1);
  int64_t d = (N - 1) << R;
  for (long long int a : {2, 7, 61}) {
    int64_t x = powermod(a % N, d, N);
    if (x <= 1 || x == N - 1) {
      continue;
    }
    for (long long int i = 0; i < R - 1 && x != N - 1; i++) {
      x = x * x % N;
    }
    if (x != N - 1) {
      return false;
    }
  }
  return true;
}
vector<vector<long long int>> adj;
vector<long long int> color;
vector<long long int> time_in, time_out;
long long int dfs_timer = 0;
void dfs(long long int v) {
  time_in[v] = dfs_timer++;
  color[v] = 1;
  for (long long int u : adj[v])
    if (color[u] == 0) dfs(u);
  color[v] = 2;
  time_out[v] = dfs_timer++;
}
long long int bin_search(long long int a[], long long int n,
                         long long int val) {
  long long int l = 0, u = n - 1, mid;
  while (l <= u) {
    mid = (l + u) / 2;
    if (val < a[mid])
      u = mid - 1;
    else if (val > a[mid])
      l = mid + 1;
    else {
      break;
    }
  }
  return (l + u) / 2;
}
vector<long long int> dist, parent;
void addEdge(vector<pair<long long int, long long int>> adj[], long long int u,
             long long int v, long long int wt) {
  adj[u].push_back(make_pair(v, wt));
  adj[v].push_back(make_pair(u, wt));
}
void dijkstra(vector<pair<long long int, long long int>> adj[],
              long long int s) {
  priority_queue<pair<long long int, long long int>,
                 vector<pair<long long int, long long int>>,
                 greater<pair<long long int, long long int>>>
      pq;
  pq.push({0, s});
  dist[s] = 0;
  while (!pq.empty()) {
    long long int u = pq.top().second;
    pq.pop();
    for (auto i : adj[u]) {
      long long int w = i.second;
      long long int v = i.first;
      if (dist[v] > dist[u] + w) {
        dist[v] = dist[u] + w;
        pq.push({dist[v], v});
        parent[v] = u;
      }
    }
  }
}
void restore_path(long long int s, long long int t) {
  vector<long long int> path;
  for (long long int v = t; v != s; v = parent[v]) path.push_back(v);
  path.push_back(s);
  reverse(path.begin(), path.end());
  for (auto i : path) {
    cout << i << " ";
  }
}
void solution() {
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  map<long long int, pair<long long int, long long int>> m;
  vector<pair<long long int, long long int>> v;
  for (long long int i = 0; i < n; i++) m[i] = {s[i], i};
  for (long long int i = 0; i < n; i++) {
    for (long long int i = 0; i < n - 1; i++) {
      if (m[i + 1].first < m[i].first) {
        pair<long long int, long long int> x = {m[i + 1].first,
                                                m[i + 1].second};
        pair<long long int, long long int> y = {m[i].first, m[i].second};
        v.push_back({y.second, x.second});
        m[i] = x;
        m[i + 1] = y;
      }
    }
  }
  map<long long int, vector<long long int>> adj;
  set<long long int> s1;
  for (auto i : v) {
    adj[i.first].push_back(i.second);
    adj[i.second].push_back(i.first);
    s1.insert(i.first);
    s1.insert(i.second);
  }
  vector<long long int> side;
  side.assign(n + 1, -1);
  bool is_bipartite = true;
  queue<long long int> q;
  for (auto st : s1) {
    if (side[st] == -1) {
      q.push(st);
      side[st] = 0;
      while (!q.empty()) {
        long long int v = q.front();
        q.pop();
        for (auto u : adj[v]) {
          if (side[u] == -1) {
            side[u] = side[v] ^ 1;
            q.push(u);
          } else {
            is_bipartite &= side[u] != side[v];
          }
        }
      }
    }
  }
  if (is_bipartite) {
    cout << "YES" << endl;
    for (long long int i = 0; i < n; i++) {
      if (side[i] == -1)
        cout << 0;
      else
        cout << side[i];
    }
  } else
    cout << "NO" << endl;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solution();
  return 0;
}
