#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  solve();
  return 0;
}
inline long long max(long long a, int b) { return max(a, (long long)b); }
inline long long max(int a, long long b) { return max((long long)a, b); }
inline long long min(long long a, int b) { return min(a, (long long)b); }
inline long long min(int a, long long b) { return min((long long)a, b); }
template <class T = long long, long long D = 1>
struct matrix : public vector<matrix<T, D - 1>> {
  matrix(long long sz, matrix<T, D - 1> dim)
      : vector<matrix<T, D - 1>>(sz, dim) {}
  matrix() : vector<matrix<T, D - 1>>() {}
};
template <class T>
struct matrix<T, 1> : public vector<T> {
  matrix(long long sz, allocator<T> v = allocator<T>()) : vector<T>(sz, v) {}
  matrix(long long sz, T v) : vector<T>(sz, v) {}
  matrix() : vector<T>() {}
  matrix(const initializer_list<T> &init) : vector<T>(init) {}
};
template <class T>
struct matrix_allocator {
  matrix_allocator(T v) : v(v) {}
  T v;
  template <typename N, typename... Ns>
  matrix<T, sizeof...(Ns) + 1> alloc(N cardinality, Ns... dims) {
    return matrix<T, sizeof...(Ns) + 1>(cardinality, alloc(dims...));
  }
  template <typename N>
  matrix<T, 1> alloc(N cardinality) {
    return matrix<T, 1>(cardinality, v);
  }
};
template <class V, typename... Ns>
static matrix<V, sizeof...(Ns)> mat(V v, Ns... dims) {
  return matrix_allocator<V>(v).alloc(dims...);
}
template <class T>
matrix<T, 1> iarr(long long n) {
  matrix<T, 1> a;
  while (n--) {
    T _v;
    cin >> _v, a.push_back(_v);
  }
  return a;
}
template <class T>
matrix<T, 2> imat(long long n, long long m) {
  matrix<T, 2> ma(n, matrix<T, 1>(m));
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) cin >> ma[i][j];
  return ma;
}
struct debugger {
  queue<string> vars;
  debugger(string str_vars) {
    stringstream ss(str_vars);
    string var;
    while (getline(ss, var, ',')) {
      vars.push(var);
    }
  }
  template <typename T, typename... Args>
  void dbg(T val, Args... args) {
    cout << "_dbg " << vars.front() << " # " << val << endl;
    vars.pop();
    dbg(args...);
  }
  template <typename T>
  void dba(matrix<T, 1> &a) {
    cout << "_dbg " << vars.front() << " # ";
    for (long long i = 0; i < a.size(); i++) {
      cout << "" << i << "[" << a[i] << "] ";
    }
    cout << endl;
  }
  template <typename T>
  void dbm(matrix<T, 2> &ma) {
    cout << "_dbg_m " << vars.front() << " # " << endl;
    for (auto &_r : ma) {
      cout << "_dbg_m ";
      for (auto &v : _r) {
        cout << v << " ";
      }
      cout << endl;
    }
  }
  void dbg() {}
};
void solve() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  auto ord = mat(make_pair(' ', 0), 0);
  map<pair<char, long long>, long long> col;
  auto ans = mat(' ', n);
  for (long long i = 0; i < s.length(); i++) {
    auto &v = s[i];
    ord.push_back(make_pair(v, i));
  }
  sort(ord.begin(), ord.end());
  for (long long i = 0; i < n; i++) {
    auto p = ord[i];
    auto v = ord[i].first;
    auto k = ord[i].second;
    long long c = (col.count(p) ? col[p] : -1);
    for (long long j = 0; j < k; j++) {
      if (s[j] > v) {
        long long csj = col[make_pair(s[j], j)];
        if (c == -1) {
          c = 1 - csj;
        } else if (c == csj) {
          cout << "NO"
               << "\n";
          return;
        }
      } else {
      }
    }
    if (c == -1) {
      c = 0;
    } else {
    }
    col[p] = c;
  }
  cout << "YES"
       << "\n";
  for (auto &_p : col) {
    auto &k = _p.first;
    auto &v = _p.second;
    ans[k.second] = v + '0';
  }
  cout << string(ans.begin(), ans.end()) << "\n";
}
