#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
char s[maxn];
int n, col[maxn], res;
int main() {
  cin >> n;
  scanf("%s", s + 1);
  for (char c = 'a'; c <= 'z'; c++) {
    int i = n;
    while (i >= 1 && s[i] != c) i--;
    for (; i >= 1;) {
      int j = i - 1;
      while (j >= 1 && s[j] != c) {
        if (s[j] > c && col[j] == col[i]) col[j] = col[i] + 1;
        j--;
      }
      i = j;
    }
  }
  for (int i = 1; i <= n; i++) res = max(res, col[i]);
  if (res > 1)
    printf("NO\n");
  else {
    printf("YES\n");
    for (int i = 1; i <= n; i++) printf("%d", col[i]);
  }
}
