Given a string formula representing a chemical formula, return the count of each atom.
An atomic element always begins with an uppercase letter, optionally followed by zero or more lowercase letters.
One or more digits representing that element’s count may follow if the count is greater than
A formula placed inside parentheses followed by a count (also optionally omitted if equal to
Return the total count of each atom as a string where elements are sorted in lexicographical order, followed by their count (if greater than
Constraints:
formula.length
formula consists of English letters, digits, '(', and ')'.
formula is always valid.
Given a string formula representing a chemical formula, return the count of each atom.
An atomic element always begins with an uppercase letter, optionally followed by zero or more lowercase letters.
One or more digits representing that element’s count may follow if the count is greater than
A formula placed inside parentheses followed by a count (also optionally omitted if equal to
Return the total count of each atom as a string where elements are sorted in lexicographical order, followed by their count (if greater than
Constraints:
formula.length
formula consists of English letters, digits, '(', and ')'.
formula is always valid.