#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> vec(n);
  vector<int> kactane(30, 0);
  vector<int> harfmax(30, 0);
  int res = 0;
  for (int i = 0; i < n; i++) {
    int cnt = 0;
    kactane[s[i] - 'a']++;
    for (int u = s[i] - 'a' + 1; u <= 'z' - 'a'; u++) {
      if (kactane[u]) {
        cnt = max(cnt, harfmax[u]);
      }
    }
    harfmax[s[i] - 'a'] = max(harfmax[s[i] - 'a'], cnt + 1);
    vec[i] = cnt;
    res = max(res, vec[i]);
    if (res > 1) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES\n";
  for (auto& x : vec) cout << x;
  return 0;
}
