Python solution using eval
\n    def subtractProductAndSum(self, n: int) -> int:\n        s=str(n)\n        m=s.replace(\'\',\'*\')[1:-1]\n        a=s.replace(\'\',\'+\')[1:-1]\n        r
```\n    def subtractProductAndSum(self, n: int) -> int:\n        s=str(n)\n        m=s.replace(\'\',\'*\')[1:-1]\n        a=s.replace(\'\',\'+\')[1:-1]\n        return eval(m)-eval(a)\n```
['Python', 'Python3']