#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  string res(n, '$');
  string an = res;
  string s;
  cin >> s;
  vector<vector<int>> index(26);
  for (int i = 0; i < n; i++) index[s[i] - 'a'].push_back(i);
  string tmp = s;
  sort(tmp.begin(), tmp.end());
  int ind;
  for (int i = 0; i < n; i++) {
    if (tmp[i] == s[i]) {
      if (res[i] == '$') res[i] = '0';
      if (an[i] == '$') an[i] = '0';
      continue;
    }
    auto it =
        upper_bound(index[tmp[i] - 'a'].begin(), index[tmp[i] - 'a'].end(), i);
    ind = *it;
    if (res[ind] == '$') res[ind] = '1';
    if (an[ind] == '$') an[ind] = '1';
    char smb = an[ind];
    for (int j = ind - 1; j >= i; j--) {
      if (an[j] == smb) {
        cout << "NO\n";
        return;
      }
      int id =
          lower_bound(index[s[j] - 'a'].begin(), index[s[j] - 'a'].end(), j) -
          index[s[j] - 'a'].begin();
      index[s[j] - 'a'][id]++;
      id = lower_bound(index[s[j + 1] - 'a'].begin(),
                       index[s[j + 1] - 'a'].end(), j + 1) -
           index[s[j + 1] - 'a'].begin();
      index[s[j + 1] - 'a'][id]--;
      if (an[j] == '$') an[j] = '0';
      if (res[j] == '$') res[j] = '0';
      swap(s[j], s[j + 1]);
      swap(an[j], an[j + 1]);
    }
  }
  cout << "YES\n" << res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
