#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<long long int> col;
  int zero = 0, one = 0;
  col.push_back(0);
  for (int i = 1; i < s.size(); i++) {
    if (s[i] >= s[zero]) {
      col.push_back(0);
      zero = i;
    } else {
      if (s[i] < s[one] && one != 0) {
        cout << "NO";
        return 0;
      } else {
        col.push_back(1);
        one = i;
      }
    }
  }
  cout << "YES" << '\n';
  for (auto i : col) cout << i;
  return 0;
}
