Solution in c++ by calculating numerator and denominator
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    string fractionAddition(string expression) {\n        int n = expression.size();\n        int i = 0;\n        vector<int> num, denom;\n\n        while (i < n) {\n            int pro = 1;\n            if (expression[i] == \'-\' || expression[i] == \'+\') {\n                pro = (expression[i] == \'-\') ? -1 : 1;\n                i++;\n            }\n\n            int x = 0;\n            while (i < n && isdigit(expression[i])) {\n                x = x * 10 + (expression[i] - \'0\');\n                i++;\n            }\n            num.push_back(pro * x);\n\n            i++;\n            \n            x = 0;\n            while (i < n && isdigit(expression[i])) {\n                x = x * 10 + (expression[i] - \'0\');\n                i++;\n            }\n            denom.push_back(x);\n        }\n\n        int dm = denom[0];\n        for (auto it : denom) {\n            dm = (dm * it) / __gcd(dm, it);\n        }\n\n        int sum = 0;\n        for (int i = 0; i < num.size(); i++) {\n            sum += num[i] * (dm / denom[i]);\n        }\n\n        int f = __gcd(abs(sum), dm);\n        sum /= f;\n        dm /= f;\n\n        if (sum == 0) {\n            return "0/1";\n        }\n\n        string ans = (sum < 0 ? "-" : "") + to_string(abs(sum)) + "/" + to_string(dm);\n        return ans;\n    }\n};\n\n```
['C++']