#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, col[N], mx[26], ans;
char s[N];
int main() {
  cin >> n >> (s + 1);
  for (int i = n; i; i--) {
    col[i] = mx[s[i] - 'a'] + 1;
    for (int j = s[i] - 'a' + 1; j < 26; j++) mx[j] = max(mx[j], col[i]);
    ans = max(ans, col[i]);
  }
  if (ans > 2) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  for (int i = 1; i <= n; i++) cout << col[i] - 1;
  return 0;
}
