#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1& a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1& a, T2 b) {
  if (a < b) a = b;
}
const int MOD = 1e9 + 7;
const int MAX = 200020;
const double pi = acos(-1);
const double EPS = 1e-12;
const long long INF = 1e18;
const int INT_INF = 1e9;
void solve() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<int> ans(N);
  vector<int> cnt(26);
  for (int i = 0; i < N; ++i) {
    int num = S[i] - 'a';
    int mx = 1;
    for (int j = num + 1; j < 26; ++j) {
      mx = max(mx, cnt[j] + 1);
    }
    cnt[num] = mx;
    ans[i] = mx;
  }
  int mx = 0;
  for (int i = 0; i < N; ++i) mx = max(mx, ans[i]);
  if (mx > 2) {
    cout << ("NO") << '\n';
  } else {
    cout << ("YES") << '\n';
    for (int i = 0; i < N; ++i) ans[i]--;
    for (int i = 0; i < N; ++i) cout << ans[i];
    cout << endl;
  }
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}
