#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  string s;
  cin >> n >> s;
  string p = s;
  sort(p.begin(), p.end());
  vector<pair<char, pair<long long, long long>>> v;
  for (int i = 0; i < n; i++) v.push_back({s[i], {-1, i}});
  for (int i = 0; i < n; i++) {
    if (v[i].first != p[i]) {
      long long f0 = 0;
      long long f1 = 0;
      for (int j = i + 1; j < n; j++) {
        if (v[j].first == p[i]) {
          pair<char, pair<long long, long long>> pp = v[j];
          if (pp.second.first == 1) {
            for (int k = j; k > i; k--) {
              v[k] = v[k - 1];
              if (v[k].second.first == 1) {
                cout << "NO";
                return;
              }
              v[k].second.first = 0;
            }
            v[i] = pp;
            v[i].second.first = 1;
          } else if (pp.second.first == 0) {
            for (int k = j; k > i; k--) {
              v[k] = v[k - 1];
              if (v[k].second.first == 0) {
                cout << "NO";
                return;
              }
              v[k].second.first = 1;
            }
            v[i] = pp;
            v[i].second.first = 0;
          } else {
            if (f1 > 0) {
              for (int k = j; k > i; k--) {
                v[k] = v[k - 1];
                v[k].second.first = 1;
              }
              v[i] = pp;
              v[i].second.first = 0;
            } else {
              for (int k = j; k > i; k--) {
                v[k] = v[k - 1];
                v[k].second.first = 0;
              }
              v[i] = pp;
              v[i].second.first = 1;
            }
          }
          break;
        } else {
          if (v[i].second.first == 0) f0++;
          if (v[i].second.first == 1) f1++;
        }
      }
    }
  }
  cout << "YES\n";
  long long ans[n + 1];
  for (int i = 0; i < n; i++) {
    ans[v[i].second.second] = v[i].second.first;
    if (v[i].second.first == -1) ans[v[i].second.second] = 0;
  }
  for (int i = 0; i < n; i++) cout << ans[i];
  cout << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    solve();
  }
}
