#K10421. Taco Operations Counting Challenge
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 letterx
(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)
ordelete()
.
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.
## sample6
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