#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10;
long long n;
queue<long long> a[27];
char c[N];
string s;
int main() {
  cin >> n >> s;
  s = " " + s;
  long long m = 'a';
  string ans = "";
  for (long long i = 1; i <= n; i++) {
    c[i] = s[i];
    m = max(m, (long long)s[i]);
    if (s[i] >= m)
      ans += "0";
    else
      ans += "1";
  }
  sort(c + 1, c + n + 1);
  for (long long i = 1; i <= n; i++) a[c[i] - 'a'].push(i);
  m = 0;
  for (long long i = 1; i <= n; i++) {
    long long tam = s[i] - 'a';
    long long tam1 = a[tam].front();
    a[tam].pop();
    if (ans[i - 1] == '0')
      m++;
    else {
      if (m < i - tam1) {
        cout << "NO";
        return 0;
      }
      m = i - tam1;
    }
  }
  cout << "YES\n" << ans;
}
