#define _USE_MATH_DEFINES #include #include #include #include #include #include //#include #include #include #include #include #include #include ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)< ///////// typedef long long LL; typedef long double LD; ///////// using namespace::std; ///////// vector bbb(string s,int n){ vector ans(11),temp(11); rep(i,11){ ans[i]=0; temp[i]=0; } LL ter=0,X=0; for(int i = n;i0){ if( ter == 0){ ans[X] = ans[X] + 1; }else{ ans[X] = ans[X] + ter; ter = 0; } X = 0; }else{ ans[0] = ans[0] + ter; } ter = 0; }else if( s[i] == 'x'){ ++X; }else if( s[i] == '*'){ }else if( s[i] == '{'){ }else if( s[i] == '}'){ if(X>0){ if( ter == 0){ ans[X] = ans[X] + 1; }else{ ans[X] = ans[X] + ter; ter = 0; } X = 0; }else{ ans[0] = ans[0] + ter; } ter = 0; for(int j= 0;j<=10;++j){ ans[j] = (j+1)*ans[j+1]; } ans[11] = i; return ans; }else{ if(ter != 0){ ter = ter * (s[i] - '0'); }else{ ter = s[i] - '0'; } } } if(X>0){ if( ter == 0){ ans[X] = ans[X] + 1; }else{ ans[X] = ans[X] + ter; ter = 0; } X = 0; }else{ ans[0] = ans[0] + ter; } ter = 0; return ans; } int main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;// //cout << setprecision(16);// int N,d; string s; cin>>N>>d>>s; vector ans(11); ans = bbb(s,0); for(int i=0;i<=d;++i){ cout << ans[i]; if(i != d){ cout << " "; }else{ cout << endl; } } return 0; }