#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<vector<int>> can(26, vector<int>(400, 0));
  vector<int> res(n);
  for (int i = 0; i < n; ++i) {
    int col = 0;
    while (col <= 26) {
      bool flag = true;
      for (int j = s[i] - 'a' + 1; j < 26; ++j) {
        if (can[j][col]) {
          flag = false;
          break;
        }
      }
      if (flag) break;
      ++col;
    }
    assert(col <= 26);
    res[i] = col;
    can[s[i] - 'a'][col] = 1;
  }
  if (*max_element(res.begin(), res.end()) >= 2)
    cout << "NO\n";
  else {
    cout << "YES\n";
    for (auto& x : res) cout << x;
  }
}
