#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long infinity = 1000000000000000000;
const int inf = 1e9 + 5;
bool do_debug = false;
template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
  for (auto element : v) {
    os << element << "";
  }
  return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S>& p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T>& v) {
  if (v.size() == 0) {
    os << "empty set\n";
    return os;
  }
  auto endit = v.end();
  endit--;
  os << "[";
  for (auto it = v.begin(); it != v.end(); it++) {
    os << *it;
    if (it != endit) {
      os << ", ";
    }
  }
  os << "]";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, multiset<T>& v) {
  if (v.size() == 0) {
    os << "empty multiset\n";
    return os;
  }
  auto endit = v.end();
  endit--;
  os << "[";
  for (auto it = v.begin(); it != v.end(); it++) {
    os << *it;
    if (it != endit) {
      os << ", ";
    }
  }
  os << "]";
  return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, map<T, S>& v) {
  if (v.size() == 0) {
    os << "empty map\n";
    return os;
  }
  auto endit = v.end();
  endit--;
  os << "{";
  for (auto it = v.begin(); it != v.end(); it++) {
    os << "(" << (*it).first << " : " << (*it).second << ")";
    if (it != endit) {
      os << ", ";
    }
  }
  os << "}";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<vector<T>>& v) {
  for (auto& subv : v) {
    for (auto& e : subv) {
      os << e << " ";
    }
    os << "\n";
  }
  return os;
}
void solve() {
  int len;
  cin >> len;
  vector<int> v(len);
  multiset<int> ms;
  multiset<int> mms;
  vector<int> ans(len, 0);
  for (int i = 0; i < len; i++) {
    char c;
    cin >> c;
    v[i] = c - 'a';
    ms.insert(v[i]);
  }
  for (int i = 0; i < len; i++) {
    ms.erase(ms.find(v[i]));
    mms.insert(v[i]);
    if (ms.size() && *ms.begin() < v[i]) {
      ans[i] = 1;
      if (mms.upper_bound(v[i]) != mms.end()) {
        cout << "NO\n";
        return;
      }
    }
  }
  cout << "YES\n";
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q = 1;
  while (q-- > 0) {
    solve();
  }
  return 0;
}
