#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 2e5 + 5;
int dp[N], mx[30];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 1;
  for (int i = 0; i < n; ++i) {
    int c = s[i] - 'a';
    dp[i] = 1;
    for (int j = c + 1; j < 26; ++j) dp[i] = max(dp[i], mx[j] + 1);
    ans = max(ans, dp[i]);
    mx[c] = max(mx[c], dp[i]);
  }
  if (ans > 2) cout << "NO", exit(0);
  cout << "YES\n";
  for (int i = 0; i < n; ++i) cout << dp[i] - 1;
}
