#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
const int inf = INT_MAX;
const long long inff = 1e18;
const long long mod = 1e9 + 7;
int n;
string s;
vector<int> v[30];
int ans[maxn];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int ok = 0;
    for (int j = s[i] - 'a'; j >= 0; j--) {
      if (((int)(v[j]).size()) > 0) {
        ans[i] = v[j].back();
        v[j].pop_back();
        v[s[i] - 'a'].push_back(ans[i]);
        ok = 1;
        break;
      }
    }
    if (!ok) {
      cnt++;
      ans[i] = cnt;
      v[s[i] - 'a'].push_back(ans[i]);
    }
  }
  if (cnt > 2) return cout << "NO" << '\n', 0;
  cout << "YES" << '\n';
  for (int i = 0; i < n; i++) cout << ans[i] - 1;
}
