#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  bool ok = true;
  cin >> n;
  char s[n + 1];
  int i2r[n + 1], col[n + 1];
  deque<int> idx[26];
  for (int i = 1; i <= n; ++i) {
    col[i] = -1;
    cin >> s[i];
    idx[s[i] - 'a'].push_back(i);
  }
  sort(s + 1, s + n + 1);
  for (int i = 1; i <= n; ++i) {
    i2r[idx[s[i] - 'a'].front()] = i;
    idx[s[i] - 'a'].pop_front();
  }
  for (int i = 2; i <= n; ++i) {
    vector<int> tmp;
    bool ok0 = false, ok1 = false;
    for (int j = i - 1; j >= 1; --j)
      if (i2r[j] > i2r[i]) {
        tmp.push_back(j);
        if (col[j] == 0)
          ok0 = true;
        else if (col[j] == 1)
          ok1 = true;
      }
    if ((ok0 && ok) || (ok0 && col[i] == 0) || (ok1 && col[i] == 1)) {
      ok = false;
      break;
    } else if (ok0 || col[i] == 1) {
      col[i] = 1;
      for (auto it : tmp) col[it] = 0;
    } else if (!tmp.empty()) {
      col[i] = 0;
      for (auto it : tmp) col[it] = 1;
    }
  }
  if (!ok) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  for (int i = 1; i <= n; ++i) {
    if (col[i] == -1) col[i] = 0;
    cout << col[i];
  }
}
