calculate_chairs(events)
events is an array of input strings. For each input string, walk through its characters and return an array containing the final total number of chairs for each string.
C (customer arrives): if a chair is available, reuse it; otherwise buy a new chair.R (customer leaves): if any chairs exist, return one to the available pool.U behaves like C — seat a customer.L behaves like R — release a chair back to the available pool.C and U have matching behavior, as do R and L, the initial version may have represented C/R and U/L as separate categories, such as distinct seating areas.C with U; if separate totals are expected for each category, clarify that requirement before coding.R or L event when no chair can be released, which should simply do nothing rather than fail.