#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> s;
  string ans(n, ' ');
  char a = '\0', b = '\0';
  for (int i = 0; i < n; i++) {
    if (s[i] >= a) {
      a = s[i];
      ans[i] = '0';
    } else if (s[i] >= b) {
      b = s[i];
      ans[i] = '1';
    } else {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n" << ans << '\n';
}
