code: def parseEquation(self, inp):
          inp = MathService._preprocess(inp)
          split = inp.split(' ')
          for i, w in enumerate(split):
              if w in self.__unaryOperators__:
                  op = self.__unaryOperators__[w]
                  eq1 = ' '.join(split[:i])
                  eq2 = ' '.join(split[i + 1:])
                  result = MathService._applyUnary(self.parseEquation(eq2), op)
                  return self.parseEquation(eq1 + " " + str(result))
          def extractNumbersAndSymbols(inp):
              numbers = []
              symbols = []
              next_number = ""
              for w in inp.split(' '):
                  if w in self.__binaryOperators__:
                      symbols.append(self.__binaryOperators__[w])
                      if next_number:
                          numbers.append(next_number)
                          next_number = ""
                  else:
                      if next_number:
                          next_number += " "
                      next_number += w
              if next_number:
                  numbers.append(next_number)
              def convert(n):
                  if n in self.__constants__:
                      return self.__constants__[n]
                  converter = NumberService()
                  return converter.parse(n)
              numbers = [convert(n) for n in numbers]
              return numbers, symbols
          numbers, symbols = extractNumbersAndSymbols(inp)
          return MathService._calculate(numbers, symbols)