from collections import Counter  def construct_digits(s):                k = [“z”, “w”, “u”, “x”, “g”,          “h”, “o”, “f”, “v”, “i”]      l = [“zero”, “two”, “four”, “six”, “eight”,         “three”, “one”, “five”, “seven”, “nine”]      c = [0, 2, 4, 6, 8, 3, 1, 5, 7, 9]              ans = []                  d = Counter(s)          for i in range(len(k)):                  x = d.get(k[i], 0)                          for j in range(len(l[i])):                                                    d[l[i][j]]-= x                              ans.append(str(c[i])*x)          ans.sort()      return “”.join(ans)    s = “fviefuro”  print(construct_digits(s))

Continue Reading