Greedy || Basic Math || Easiest Solution || Beats 100%
\n# Code\ncpp []\nclass Solution {\npublic:\n    string fractionAddition(string expression) {\n        vector<pair<int, int>> pt;\n        \n        int n = exp
\n# Code\n```cpp []\nclass Solution {\npublic:\n    string fractionAddition(string expression) {\n        vector<pair<int, int>> pt;\n        \n        int n = expression.size();\n        int count = 1;\n        int z = 1;\n        \n        for (int i = 0; i < n; i++) {\n            if (expression[i] == \'/\') {\n                continue;\n            }\n            if (expression[i] == \'-\') {\n                count = -1;\n                continue;\n            }\n            if (expression[i] == \'+\') {\n                count = 1;\n                continue;\n            }\n            int x = 0;\n            int zz = 0;\n            while (i < n && isdigit(expression[i])) {\n                x = x * 10 + (expression[i] - \'0\');\n                i++;\n            }\n            x *= count;\n            if (i < n && expression[i] == \'/\') {\n                i++;\n                while (i < n && isdigit(expression[i])) {\n                    zz = zz * 10 + (expression[i] - \'0\');\n                    i++;\n                }\n                pt.push_back({x, zz});\n                z *= zz;\n            }\n            i--;\n        }\n        \n        int final1 = 0;\n        for (auto it : pt) {\n            int b = it.second;\n            final1 += (it.first * z) / b;\n        }\n        \n        if (final1 == 0) {\n            return "0/1";\n        }\n        \n        int gcd_val = gcd(abs(final1), z);\n        return to_string(final1 / gcd_val) + "/" + to_string(z / gcd_val);\n    }\n\nprivate:\n    int gcd(int a, int b) {\n        if (b == 0) return a;\n        return gcd(b, a % b);\n    }\n};\n```
['Math', 'String', 'Greedy', 'Simulation', 'C++']