#include <bits/stdc++.h>
using namespace std;
void _SSGJ_() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  map<long long, vector<long long> > mp;
  for (long long i = 0; i < n; i++) {
    mp[s[i] - 'a'].push_back(i + 1);
  }
  vector<long long> color(n + 1, 0);
  long long ma = 0;
  for (auto i : mp) {
    for (long long j = 0; j < (long long)i.second.size(); j++) {
      if (i.second[j] > ma) {
        ma = i.second[j];
        color[ma] = 1;
      }
    }
  }
  string p = "";
  for (long long i = 1; i <= n; i++) {
    if (color[i] == 0) {
      p += s[i - 1];
    }
  }
  string temp = p;
  sort(temp.begin(), temp.end());
  if (temp == p) {
    cout << "YES\n";
    for (long long i = 1; i <= n; i++) {
      cout << color[i];
    }
    cout << "\n";
  } else {
    cout << "NO\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  _SSGJ_();
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs"
       << "\n";
  return 0;
}
