#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, i;
  string s, ans = "";
  cin >> n >> s;
  char mx = 'a', pmx = 'a';
  for (i = 0; i < n; i++) {
    if (s[i] >= mx) {
      mx = max(mx, s[i]);
      ans += "0";
    } else {
      if (pmx <= s[i]) {
        ans += "1";
        pmx = max(pmx, s[i]);
      } else {
        cout << "NO\n";
        return;
      }
    }
  }
  cout << "YES\n" << ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
