classSolution:defsolve(self,s:str,t:str) ->str:# write code here n, m =len(s),len(t)if n < m:# 确保 n >= m s, t = t, s n, m = m, n t ='0'* (n - m) + t # 补0 ret ='' ex =0# 进位标志for i inrange(n -1, -1, -1): r =int(s[i])+int(t[i])+ ex ret =str(r %10)+ ret ex = r //10if ex: ret ='1'+ retreturn ret