#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; string nstr(){ static const int MAX_LEN = 100001; static char res_[MAX_LEN]; scanf("%s",res_); return string(res_); } int main(){ int N, d; cin >> N >> d; string S = nstr(); S += '+'; int x = -1, dx = 0; ll a = 1; vll ans(d + 1); each(c, S){ if(c != 'x' && c != '*' && !isdigit(c) && x != -1){ int y = x - dx; if(y >= 0){ ll b = a; for(int e = x; e > y; --e)b *= e; ans[y] += b; } x = -1; a = 1; } if(c == 'd')dx++; else if(c == '}')dx--; else if(c == 'x'){ if(x == -1)x = 1; else ++x; } else if(isdigit(c)){ if(x == -1)x = 0; a *= c - '0'; } } rep(i, d + 1)printf("%lld%c", ans[i], i != d ? ' ' : '\n'); }