C++ with comments
\nclass Solution {\npublic:\n    string fractionAddition(string expression) {\n        int nom = 0, denom = 1, size = expression.size();\n        for (int i = 0
```\nclass Solution {\npublic:\n    string fractionAddition(string expression) {\n        int nom = 0, denom = 1, size = expression.size();\n        for (int i = 0, j = 0; i < size;)\n        {\n            while (j < size && expression[j] != \'/\')\n            {\n                ++j; // find the index of slash \'/\' so we can get the nominator\n            }\n            \n            int slashInd = j;\n            while (j < size && expression[j] != \'+\' && expression[j] != \'-\')\n            {\n                ++j; // find the next \'+\' or \'-\' so we can get the denominator\n            }\n            \n            int end = j, curNom = stoi(expression.substr(i, slashInd - i));\n            int curDenom = stoi(expression.substr(slashInd + 1, end - slashInd - 1));\n            auto sum = addAndNorm(nom, denom, curNom, curDenom); // add the fractions \n            \n            nom = sum.first;\n            denom = sum.second; // update the latest nominator and denominator\n            i = j;\n        }\n        \n        return to_string(nom) + "/" + to_string(denom); // return the result\n    }\n\nprivate:\n    pair<int, int> addAndNorm(int nom, int denom, int curNom, int curDenom)\n    {\n        int sumNom = nom * curDenom + curNom * denom;\n        int sumDenom = denom * curDenom; // first get the reducible nominator/denominator\n        for (int n = min(abs(sumNom), abs(sumDenom)); n > 1; --n)\n        {\n            if (sumNom % n == 0 && sumDenom % n == 0)\n            {   // find the maximum common factor of the nominator and denominator\n                sumNom /= n;\n                sumDenom /= n;\n                break;\n            }\n        }\n        \n        return {sumNom, sumNom == 0 ? 1 : sumDenom}; // return the reduced format\n    }\n};\n```
[]