import java.util.*; public class Main{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int d = scan.nextInt(); String s = scan.next(); int[] z = new int[d+1]; for(int i = 0;i < d;i++) z[i] = 0; int dcount = 0 , zisuu = 0 , suu = 0; for(int i = 0;i < n;i++){ if(s.charAt(i) == 'd'){ dcount++; i++; } if(s.charAt(i) >= '1' && s.charAt(i) <= '9' || s.charAt(i) == 'x'){ if(s.charAt(i) >= '1' && s.charAt(i) <= '9'){ suu = s.charAt(i) - '0'; zisuu = 0; }else{ suu = 1; zisuu = 1; } if(i + 1 != n){ while(s.charAt(i+1) == '*' && s.charAt(i+2) == 'x'){ zisuu++; i += 2; if(i == n) break; } } if(dcount > 0){ for(int j = dcount;j > 0;j--){ suu *= zisuu; zisuu--; } if(zisuu < 0) zisuu = 0; } z[zisuu] += suu; } if(s.charAt(i) == '}') dcount--; } for(int i = 0;i < d+1;i++){ System.out.print(z[i] + " "); } } }