#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  vector<pair<long long, long long> > cnt(26);
  long long ans[n];
  long long val = 1;
  for (long long i = 0; i < n; ++i) {
    set<long long> vals;
    for (long long j = 0; j < 26; ++j) {
      if (j > s[i] - 'a' && cnt[j].first) {
        vals.insert(cnt[j].second);
      }
    }
    cnt[s[i] - 'a'].first = 1;
    if (vals.size() == val) {
      ++val;
      cnt[s[i] - 'a'].second = val;
      ans[i] = val;
    } else {
      for (long long j = 1; j <= val; ++j) {
        if (vals.find(j) == vals.end()) {
          cnt[s[i] - 'a'].second = j;
          ans[i] = j;
          break;
        }
      }
    }
  }
  if (val <= 2) {
    cout << "YES\n";
    for (long long i = 0; i < n; ++i) cout << ans[i] - 1;
    return;
  }
  cout << "NO";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
