#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
T div_floor(const T a, const T b) {
  return a >= 0 ? a / b : (a + 1) / b - 1;
}
template <class T>
T div_ceil(const T a, const T b) {
  return a >= 0 ? (a - 1) / b + 1 : a / b;
}
constexpr long long mod = 1e9 + 7;
constexpr long long INF = mod * mod;
constexpr int MAX = 100010;
typedef struct UnionFindTree {
  vector<int> par;
  UnionFindTree(int n) { par.resize(n, -1); }
  bool is_root(int x) { return par[x] < 0; }
  int find(int x) {
    if (is_root(x)) return x;
    return par[x] = find(par[x]);
  }
  int size(int x) { return -par[find(x)]; }
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return false;
    if (size(x) < size(y)) swap(x, y);
    par[x] += par[y];
    par[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
} UF;
int main() {
  int n;
  scanf("%d", &n);
  UF uf(n);
  string s;
  cin >> s;
  auto cmp = [&](const int &a, const int &b) { return s[a] < s[b]; };
  set<int, function<bool(const int &, const int &)>> S(cmp);
  S.insert(0);
  for (int(i) = (int)(1); (i) < (int)(n); ++(i)) {
    auto it = S.upper_bound(i);
    if (it == S.begin())
      S.insert(i);
    else {
      --it;
      uf.unite(*it, i);
      S.erase(it);
      S.insert(i);
    }
  }
  if (S.size() > 2)
    puts("NO");
  else {
    puts("YES");
    int cur = 0, col[n];
    for (int((i)) = (int)(0); ((i)) < (int)((n)); ++((i)))
      if (uf.is_root(i)) col[i] = cur++;
    for (int((i)) = (int)(0); ((i)) < (int)((n)); ++((i)))
      printf("%d", col[uf.find(i)]);
  }
}
