#K10421. Taco Operations Counting Challenge

    ID: 23243 Type: Default 1000ms 256MiB

Taco Operations Counting Challenge

Taco Operations Counting Challenge

You are given an initially empty string. You will be given a series of operations to perform on this string. There are two types of operations:

  • append(x): Append the lowercase letter x (where x is between a and z) to the end of the string.
  • delete(): Delete the last character of the string if the string is not empty.

After all operations are performed, count the frequency of each character from a to z in the final string and output the 26 counts in order separated by a space.

The counts should be output as: $$count(a)\ count(b)\ \cdots\ count(z)$$ (i.e. 26 space separated integers).

inputFormat

The input is read from stdin and has the following format:

  • The first line contains a single integer Q, the number of operations.
  • The following Q lines each contain an operation which is either in the form append(x) or delete().

outputFormat

Output a single line to stdout containing 26 space-separated integers representing the counts of the characters from a to z in the final string after processing all operations.

## sample
6
append(a)
append(b)
append(a)
delete()
append(c)
append(c)
1 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0