#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long col[n + 1];
  for (long long i = 0; i < n; i++) {
    col[i] = 1;
  }
  long long f[26] = {0};
  for (long long i = 0; i < n; i++) {
    char c = s[i];
    for (long long x = 25; x > c - 'a'; x--) {
      col[i] = max(col[i], 1 + f[x]);
    }
    f[c - 'a'] = max(f[c - 'a'], col[i]);
  }
  long long k = *max_element(col, col + n);
  if (k > 2) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    for (long long i = 0; i < n; i++) {
      cout << col[i] - 1;
    }
  }
  return 0;
}
