#include <bits/stdc++.h>
using namespace std;
long long exp(long long taban, long long us) {
  long long carpan = taban;
  long long temp = us;
  long long res = 1;
  for (int i = 0;; i++) {
    if (temp % 2) res = (res * carpan) % 1000000007;
    temp /= 2;
    carpan = (carpan * carpan) % 1000000007;
    if (temp == 0) break;
  }
  return res;
}
long long ebob(long long a, long long b) {
  if (!a) return b;
  return ebob(b % a, a);
}
long long ekok(long long a, long long b) {
  return (((a * b) % 1000000007) *
          (exp(ebob(a, b), (long long)1000000007 - 2))) %
         1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  if (n == 1) {
    cout << "YES\n" << 0;
    return 0;
  }
  string s;
  cin >> s;
  vector<bool> vec(n, 0);
  vector<bool> changed(n, 0);
  bool check = true;
  bool check2 = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int k = i + 1; k < n; k++) {
      if (s[i] > s[k]) {
        if (vec[k] != !vec[i] && changed[k]) {
          cout << "NO";
          return 0;
        }
        vec[k] = !vec[i];
        changed[k] = 1;
      }
    }
  }
  cout << "YES\n";
  for (auto x : vec) cout << x;
  return 0;
}
