Go simple solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O(n^2)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n\nfunc countOfAtoms(formula string) string {\n\tn := len(formula)\n\tst := []map[string]int{}\n\tst = append(st, map[string]int{})\n\n\ti := 0\n\n\tfor i < n {\n\t\tch := formula[i]\n\t\tif ch == \'(\' {\n\t\t\tst = append(st, map[string]int{})\n\t\t\ti++\n\t\t} else if ch == \')\' {\n\t\t\ttop := st[len(st)-1]\n\t\t\tst = st[:len(st)-1]\n\t\t\ti++\n\n\t\t\t// get digits\n\t\t\tstart := i\n\t\t\tfor i < n && formula[i] >= \'0\' && formula[i] <= \'9\' {\n\t\t\t\ti++\n\t\t\t}\n\t\t\tdigits, err := strconv.Atoi(string(formula[start:i]))\n\t\t\tif err != nil {\n\t\t\t\tdigits = 1\n\t\t\t}\n\n\t\t\t// multiply\n\t\t\tfor k, v := range top {\n\t\t\t\tst[len(st)-1][k] += v * digits\n\t\t\t}\n\n\t\t} else {\n\t\t\tatom := []byte{ch}\n\t\t\ti++\n\t\t\t// get atom\n\t\t\tfor i < n && formula[i] >= \'a\' && formula[i] <= \'z\' {\n\t\t\t\tatom = append(atom, formula[i])\n\t\t\t\ti++\n\t\t\t}\n\n\t\t\t// get digits\n\t\t\tstart := i\n\t\t\tfor i < n && formula[i] >= \'0\' && formula[i] <= \'9\' {\n\t\t\t\ti++\n\t\t\t}\n\n\t\t\tdigits, err := strconv.Atoi(string(formula[start:i]))\n\t\t\tif err != nil {\n\t\t\t\tdigits = 1\n\t\t\t}\n\n\t\t\tst[len(st)-1][string(atom)] += digits\n\t\t}\n\t}\n\n\tres := ""\n\tkeys := []string{}\n\tfor k := range st[0] {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\n\tfor _, key := range keys {\n\t\tv := strconv.Itoa(st[0][key])\n\t\tres += key\n\t\tif st[0][key] > 1 {\n\t\t\tres+=v\n\t\t}\n\t}\n\n\treturn res\n}\n\n```
['Go']