Best C++ Code (Beats 100%)
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    using int2=pair<int, int>;\n    void print(auto& f){\n        for(auto& [x, y]: f) cout<<"("<<x<<","<<y<<")";\n        cout<<endl;\n    }\n\n    vector<int2> convert(string& expression){\n        vector<int2> fraction;\n        int sz=expression.size(), x=0, sgn=1;\n        char c=expression[0];\n        switch(c){\n            case \'+\':break;\n            case \'-\': sgn=-1; break;\n            default: x=c-\'0\';\n        }\n        int prev=0;\n        for(int i=1; i<sz; i++){\n            c=expression[i];\n            while(c>=\'0\'){\n                x=10*x+(c-\'0\');\n                if (i==sz-1) break;\n                c=expression[++i];\n            //    cout<<x<<", ";\n            }\n            switch(c){\n                case \'+\':\n                    fraction.emplace_back(prev, x);\n                    sgn=1; \n                    x=0;\n                    break;\n                case \'-\':\n                    fraction.emplace_back(prev, x); \n                    sgn=-1; \n                    x=0;\n                    break;\n                case \'/\':\n                    prev=x*sgn;\n                    x=0;\n            }  \n        }\n        // dealing with i=sz-1\n        fraction.emplace_back(prev, x);\n        return fraction;\n    }\n    int2 add(int2& x, int2& y){\n        auto [xp, xq]=x;\n        auto [yp, yq]=y;\n        long long q=xq*yq;\n        long long p=xp*yq+xq*yp;\n        long long g=gcd(p, q);\n        return {p/g, q/g};\n    }\n    \n    string fractionAddition(string& expression) {\n        auto fraction=convert(expression);\n    //    print(fraction);\n        int fz=fraction.size();\n        int2 ans={0, 1};\n        for(auto& f: fraction){\n            ans=add(ans, f);\n        }\n        string s=to_string(ans.first)+"/"+to_string(ans.second);\n        return s;\n    }\n};\n```
['C++']