✅Cpp || Faster than 100% ||  LCM and HCF
\nclass Solution {\npublic:\n    int gcd(int a,int b){\n        if(a%b==0) return b;\n        return gcd(b,a%b);\n    }\n    int getNum(int &i,string exp){  // 
```\nclass Solution {\npublic:\n    int gcd(int a,int b){\n        if(a%b==0) return b;\n        return gcd(b,a%b);\n    }\n    int getNum(int &i,string exp){  // returns numerator\n        string temp = "";\n        while(exp[i]!=\'/\'){\n            temp+=exp[i];\n            i++;\n        }\n        return stoi(temp);\n        \n    }\n     int getDen(int &i,string exp){  // returns denominator\n        string temp = "";\n        while(i<exp.size() and (exp[i]!=\'+\' and exp[i]!=\'-\')){\n            temp+=exp[i];\n            i++;\n        }\n         int num = stoi(temp);\n        return num;\n        \n    }\n    string fractionAddition(string exp) {\n        int s1 = 1;\n        int i =0 ;\n        if(exp[0]==\'-\'){\n            s1 = -1;\n            i++;\n        }\n        int num1 = getNum(i,exp);\n        i++;\n        int den1 = getDen(i,exp);\n        while(i<exp.size()){\n            int s2 = exp[i]==\'-\'?-1:1;\n            i++;\n            int num2 = getNum(i,exp);\n            i++;\n            int den2 = getDen(i,exp);\n            int lcm = (den2*den1)/gcd(den1,den2);\n            num1 = (s1*num1*(lcm/den1) + s2*num2*(lcm/den2));\n            den1 = lcm;\n            if(num1<0){\n                s1 = -1;\n                num1 *=-1;\n            }\n            else{\n                s1 = 1;\n            }\n        }\n        int gc = gcd(num1,den1);\n        if(gc>1){\n            num1 = num1/gc;\n            den1 = den1/gc;\n        }\n        string ans = "";\n        ans += s1==-1?"-":"";\n        ans += to_string(num1);\n        ans += "/";\n        ans += to_string(den1);\n        return ans;\n        \n    }\n};\n```
['C++']