Easy Solution | beats 100%
Code\npython []\nfrom fractions import Fraction\n\nclass Solution(object):\n    def fractionAddition(self, expression):\n        def parse_expression(expression
# Code\n```python []\nfrom fractions import Fraction\n\nclass Solution(object):\n    def fractionAddition(self, expression):\n        def parse_expression(expression):\n            # List to store parsed fractions\n            fractions = []\n            i = 0\n            while i < len(expression):\n                # Determine the sign of the fraction\n                if expression[i] == \'+\' or expression[i] == \'-\':\n                    sign = expression[i]\n                    i += 1\n                else:\n                    sign = \'+\'\n                \n                # Find the end of the fraction (numerator/denominator)\n                num_start = i\n                while i < len(expression) and expression[i] != \'+\' and expression[i] != \'-\':\n                    i += 1\n                num_end = i\n                \n                # Extract numerator and denominator\n                numerator, denominator = map(int, expression[num_start:num_end].split(\'/\'))\n                \n                # Apply the sign to the numerator if needed\n                if sign == \'-\':\n                    numerator = -numerator\n                \n                # Add the fraction to the list\n                fractions.append(Fraction(numerator, denominator))\n            \n            return fractions\n\n        def calculate(fractions):\n            # Sum all fractions and format the result\n            result = sum(fractions)\n            return "{}/{}".format(result.numerator, result.denominator)\n\n        # Parse the expression and calculate the result\n        fractions = parse_expression(expression)\n        return calculate(fractions)\n```\n![unnamed.jpg](https://assets.leetcode.com/users/images/6dc0774f-093e-410e-b0f7-5b91d55685ad_1724379505.9005702.jpeg)\n
['Math', 'String', 'Simulation', 'Python', 'Python3']