class Solution:
def multiply(self, num1: str, num2: str) -> str:
ZERO = '0'
if ZERO in (num1, num2):
return ZERO
L1, L2 = len(num1) - 1, len(num2) - 1
carry = 0
result = []
i = 0
while (i <= L1 + L2) or carry:
j = max(0, i - L2)
while j <= min(i, L1):
n1 = num1[L1 - j]
n2 = num2[L2 - i + j]
carry += (ord(n1) - ord(ZERO)) * (ord(n2) - ord(ZERO))
j += 1
r = chr(carry % 10 + ord(ZERO))
result.append(r)
carry //= 10
i += 1
return ''.join(result[::-1])