#include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;

int main(){
    int n, k;
    cin>>n>>k;
    string s;
    cin>>s;
    bool z = false;
    bool y = true;
    int p = 0;
    int r = 0;
    int g = 0;
    int h = 0;
    int e = 0;
    int w = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'a'){
            y = true;
            p++;
            if(p == 1){
                g = i;
            }
            else{
                h = i;
            }
        }
        else{
            z = true;
            r++;
            if(r == 1){
                e = i;
            }
            else{
                w = i;
            }
        }
        if(y && z){
            if(p >= 2 && r >= 2){
                int u = 0;
                for(int j = g; j <= h; j++){
                    if(s[j] == 'b'){
                        cout<<"3 ";
                        u++;
                    }
                }
                if(u == 0){
                    for(int j = e; j <= w; j++){
                        if(s[j] == 'a'){
                            cout<<"3 ";
                            u++;
                        }
                    }
                    if(u == 0){
                        cout<<"2 ";
                    }
                }
            }
            else{
                cout<<"2 ";
            }
        }
        else{
            cout<<"1 ";
        }
    }
}