#include <bits/stdc++.h>
using namespace std;
int64_t ar[2 * (int64_t)1e5 + 10];
int64_t ans[2 * (int64_t)1e5 + 10];
string xx;
int64_t thisfunctionfindslis() {
  vector<int64_t> rank(xx.length() + 5, 1e10);
  rank[0] = -1e10;
  int64_t len = 1;
  for (int64_t i = 0; i < xx.length(); i++) {
    int64_t st = 0;
    int64_t en = len;
    while (en >= st) {
      int64_t mid = (st + en) / 2;
      if (rank[mid] < ar[i])
        st = mid + 1;
      else
        en = mid - 1;
    }
    ans[xx.length() - i - 1] = st;
    len = max(len, st);
    rank[st] = ar[i];
  }
  return len;
}
int32_t main() {
  int64_t n;
  cin >> n;
  cin >> xx;
  for (int64_t i = n - 1; i > -1; i--) {
    ar[n - 1 - i] = (int64_t)xx[i];
  }
  int64_t len = thisfunctionfindslis();
  if (len < 3) {
    cout << "YES\n";
    for (int64_t i = 0; i < n; i++) cout << ans[i] - 1;
    cout << "\n";
  } else
    cout << "NO\n";
  return 0;
}
