#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int64_t n, i, j, k, l, sum = 0, flag = 0, t, col[200005];
bool used[26][2];
string s;
void solve() {
  cin >> n >> s;
  for (int64_t i = 0; i < n; i++) {
    bool zero = true, one = true;
    for (int64_t j = (s[i] - 'a') + 1; j < 26; j++) {
      zero &= (!used[j][0]);
      one &= (!used[j][1]);
    }
    if (zero)
      col[i] = 0, used[s[i] - 'a'][0] = true;
    else if (one)
      col[i] = 1, used[s[i] - 'a'][1] = true;
    else {
      cout << "NO\n";
      return;
    }
  }
  cout << "YES\n";
  for (int64_t i = 0; i < n; i++) {
    cout << col[i];
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int64_t test = 1;
  while (test--) {
    solve();
  }
  return 0;
}
