#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
int cnt[N][26];
int n;
char s[N];
int ans[N];
int t[26];
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 26; j++) {
      cnt[i][j] = cnt[i - 1][j] + (s[i] - 'a' == j);
    }
  }
  for (int i = 0; i < 26; i++) t[i] = 1;
  for (int i = n; i; i--) {
    ans[i] = t[s[i] - 'a'];
    for (int j = s[i] - 'a' + 1; j < 26; j++) {
      if (cnt[i - 1][j] && t[j] == t[s[i] - 'a']) t[j]++;
    }
  }
  int res = 0;
  for (int i = 1; i <= n; i++) res = max(res, ans[i]);
  if (res > 2) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) cout << ans[i] - 1;
  cout << endl;
  return 0;
}
