```python class Complex: def __init__(self, real, imag): self.real = real self.imag = imag def __add__(self, other): real = self.real + other.real imag = self.imag + other.imag return Complex(real, imag) def __str__(self): return f"{self.real}+{self.imag}i" complex1 = input().strip() complex2 = input().strip() real1, imag1 = complex1.split("+") real2, imag2 = complex2.split("+") real1 = int(real1) real2 = int(real2) imag1 = int(imag1[:-1]) imag2 = int(imag2[:-1]) c1 = Complex(real1, imag1) c2 = Complex(real2, imag2) result = c1 + c2 print(result) ``` [2024-12-11 23:48:39 | AI写代码神器 | 422点数解答]