C++ Solution
Code\n\nclass Solution {\npublic:\n    int subtractProductAndSum(int n) {\n        string s = to_string(n);\n        int mul = 1, sum = 0;\n        for(auto x: 
# Code\n```\nclass Solution {\npublic:\n    int subtractProductAndSum(int n) {\n        string s = to_string(n);\n        int mul = 1, sum = 0;\n        for(auto x: s) {\n            int v = x - \'0\';\n            mul *= v;\n            sum += v;\n        }\n        return mul - sum;\n    }\n};\n```
['C++']