Given a string representing a chemical formula, return the count of each atom. The atomic element always starts with an uppercase character, possibly followed by lowercase letters, and may have digits indicating its count. If the count is 1, no digits will follow. Formulas can be concatenated or placed in parentheses with an optional multiplier. Return the counts in sorted order as a string.
Click Run to execute sample tests.