#include<bits/stdc++.h>
using namespace std;
string str1, str2;
char pos;
bool prvi, drugi;
int n,k;
int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> k;
    cin >> str1;
    str2 = str1;
    sort(str1.begin(), str1.end());
    if(str1 == str2)
    {
        pos = str1[str1.size()-1];
        for(int i = 0; i<str1.size(); i++)
        {
            if(str1[i] == pos)
                cout << "2 ";
            else
                cout << "1 ";
        }
    }
    if(k == 2)
    {
        for(int i=0; i<str2.size(); i++)
        {
            if(str2[i] == 'a')
                prvi = 1;
            if(str2[i] == 'b')
                drugi = 1;
            if(prvi == 0 or drugi == 0)
                cout << "1 ";
            if(drugi == 1 and prvi == 1)
                cout << "2 ";
            
        }
    }
    cout << "\n";
    return 0;
}