#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e6 + 5;
const long long inf = 1e10;
const long long mod = 1e9 + 7;
long long n;
string s;
long long res[maxN];
long long f[maxN];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  cin >> s;
  for (long long i = 1; i <= n; i++) {
    long long tmp = 0;
    for (long long j = s[i - 1] + 1; j <= 'z'; j++) {
      if (f[j] == -1) {
        cout << "NO";
        return 0;
      }
      tmp = max(tmp, f[j]);
    }
    if (tmp == 0) {
      res[i] = 0;
      f[s[i - 1]] = 1;
    } else {
      res[i] = 1;
      f[s[i - 1]] = -1;
    }
  }
  cout << "YES" << endl;
  for (long long i = 1; i <= n; i++) cout << res[i];
  return 0;
}
