C++ code
The idea is to first split the string with \'+\' and \'-\' operators \nNow extracting value before \'/\' and value after \'/\' and store it in numerator and den
The idea is to first split the string with \'+\' and \'-\' operators \nNow extracting value before \'/\' and value after \'/\' and store it in numerator and denominator vector \nFind LCM of denominator and store it in lcm \nNow lcm / denominator[i] gives us the multiply factor which needs to be multiplied to numerator \nIterate through numerator , multiply the multiply factor to numerator and add it to sum ; \nNow to simplify find HCF or GCD of abs(lcm) and abs(sum) and store it as divFact ;\nsum = sum / divFact and lcm = lcm / divFact \nans = to_string(sum) + \'/\' + to_string(lcm) ;\n\n\tint gcd(int a , int b){\n        if(b == 0){\n            return a ; \n        }\n        return gcd(b , a%b) ; \n    }\n    \n    int LCM(vector<int> Denominator){\n        int lcm = 1 ; \n        for(int i = 0 ; i < Denominator.size() ; i++){\n            lcm = lcm * Denominator[i] / gcd(lcm , Denominator[i]) ; \n        }\n        return lcm ; \n    }\n    \n    int to_int(string Expression){\n        int sign = 1 ;\n        int i = 0;\n        if(Expression[0] == \'-\'){\n            sign = -1 ;\n            i = 1 ; \n        }\n        int number = 0 ; \n        while(i < Expression.size()){\n            number = number * 10 + (Expression[i] - \'0\') ; \n            i++ ; \n        }\n        number = number * sign ;\n        return number ;\n    }\n    \n    vector<string> splitValues(string s){\n        string temp ;\n        vector<string> splitExpression ;\n        int n = s.size() ; \n        for(int i = 0 ; i < n ; i++){\n            while( i < n and s[i] != \'+\' and s[i] != \'-\'){\n                temp+=s[i] ; \n                i++;\n            }\n            if(i < n and s[i] == \'-\'){\n                if(temp.size() > 0)\n                    splitExpression.push_back(temp) ;\n                temp = \'-\' ;\n                continue ; \n            }\n            else if(i<n and s[i] == \'+\'){\n                if(temp.size() > 0)\n                    splitExpression.push_back(temp) ;\n                temp.erase() ; \n                continue ;\n            }\n        }\n        if(temp.size() > 0)\n            splitExpression.push_back(temp) ; \n        return splitExpression ;\n    }\n    \n    string fractionAddition(string expression) {\n        vector<int> Numerator ; \n        vector<int> Denominator ; \n        \n        vector<string> splitExpression = splitValues(expression) ;\n        for(auto x : splitExpression){\n            int idx = x.find(\'/\') ; \n            string firstHalf = x.substr(0,idx) ;\n            string secondHalf = x.substr(idx + 1 , 40) ; \n            cout << firstHalf << "  " << secondHalf << endl <<endl ;\n            Numerator.push_back(to_int(firstHalf)) ; \n            Denominator.push_back(to_int(secondHalf)) ;\n        }\n        int lcm = LCM(Denominator) ; \n        //cout << lcm <<endl ;\n        int sum = 0 ; \n        for(int i = 0 ; i < Denominator.size() ; i++){\n            int val = lcm / Denominator[i] ; \n            sum += (val * Numerator[i]) ; \n        }\n        //cout << sum << endl ; \n        int divFact = abs(gcd(abs(sum) , abs(lcm))) ;\n        //cout << divFact << endl ;  \n        sum = sum / divFact ; \n        lcm = lcm / divFact ; \n        string ans = to_string(sum) + \'/\' + to_string(lcm) ;  \n        return ans ;\n    }\n\t\n\t\n\t// Happy Coding
['Math']