#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int m[27][27];
int c[300000];
int main() {
  cin >> n >> s;
  int mam = 0;
  for (int i = 0; i < n; i++) {
    s[i] -= 'a';
    int j = 0;
    while (m[s[i] + 1][j]) j++;
    c[i] = j;
    mam = max(mam, j + 1);
    int k = s[i];
    while (k) {
      m[k][j] = 1;
      k--;
    }
  }
  if (mam > 2)
    cout << "NO\n";
  else {
    cout << "YES\n";
    for (int i = 0; i < n; i++) cout << c[i];
  }
}
