#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF = 1e18;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  string s;
  cin >> s;
  char ch = s[0];
  s[0] = '0';
  for (long long i = 1; i < n; i++) {
    if (s[i] >= ch) {
      ch = s[i];
      s[i] = '0';
    }
  }
  long long j = -1;
  for (long long i = 0; i < n; i++) {
    if (s[i] != '0') {
      j = i;
      break;
    }
  }
  if (j != -1) {
    ch = s[j];
    s[j] = '1';
    for (long long i = j + 1; i < n; i++) {
      if (s[i] == '0') continue;
      if (s[i] >= ch) {
        ch = s[i];
        s[i] = '1';
      }
    }
  }
  long long flg = 0;
  for (long long i = 0; i < n; i++) {
    if (s[i] != '0' and s[i] != '1') flg++;
  }
  if (flg) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    cout << s << endl;
  }
  return 0;
}
