1def solveEquation(self, equation: str) -> str:2"""O(N)TS"""3x, y, p = 0, 0, 14for i in re.finditer(r"=|[+-]?\d*x|[+-]?\d+", equation):5g = i.group()6if g == "=":7p = -18elif g[-1] == "x":9x += p * int(10g.replace("x", "1" if len(g) == 1 or not g[-2].isdigit() else "")11)12else:13y += -p * int(g)1415if x == 0 == y:16return "Infinite solutions"17elif x == 0:18return "No solution"19return f"x={y // x}"