#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
pair<T, U> operator+(const std::pair<T, U>& l, const std::pair<T, U>& r) {
  return {l.first + r.first, l.second + r.second};
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> color(n, -1);
  vector<pair<int, int> > swaps;
  bool b = true;
  for (int i = n - 1; i >= 0; i--) {
    if (color[n - i - 1] == -1) color[n - i - 1] = 0;
    for (int j = 1; j <= i; j++) {
      if (s[j - 1] > s[j]) {
        if (color[j] != -1 && color[j - 1] != -1 && color[j] == color[j - 1])
          b = false;
        else if (color[j - 1] == -1 && color[j] != -1)
          color[j - 1] = 1 - color[j];
        else if (color[j - 1] != -1)
          color[j] = 1 - color[j - 1];
        else {
          color[j - 1] = 0;
          color[j] = 1;
        }
        swap(s[j], s[j - 1]);
        swap(color[j], color[j - 1]);
        swaps.push_back(make_pair(j, j - 1));
      }
    }
  }
  if (!b)
    cout << "NO" << endl;
  else {
    cout << "YES" << endl;
    for (int i = swaps.size() - 1; i >= 0; i--) {
      swap(color[swaps[i].first], color[swaps[i].second]);
    }
    for (int i = 0; i < n; i++) {
      if (color[i] == -1) color[i] = 0;
      cout << color[i];
    }
    cout << endl;
  }
}
