#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  string s;
  cin >> s;
  map<char, set<int>> char_index;
  for (int i = 0; i < n; i++) char_index[s[i]].insert(i);
  vector<int> A = {-1}, B = {-1};
  for (auto &it : char_index) {
    set<int> &indexs = it.second;
    for (auto &index : indexs) {
      if (A.back() > index && B.back() > index) {
        cout << "NO" << endl;
        return 0;
      } else if (A.back() > index)
        B.push_back(index);
      else if (B.back() > index)
        A.push_back(index);
      else {
        if (B.back() > A.back())
          B.push_back(index);
        else
          A.push_back(index);
      }
    }
  }
  vector<char> ans(n);
  cout << "YES" << endl;
  for (int i = 1; i < A.size(); i++) ans[A[i]] = '0';
  for (int i = 1; i < B.size(); i++) ans[B[i]] = '1';
  for (auto &c : ans) cout << c;
  cout << endl;
}
