@anonymous/

VisibleBisqueServer

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def add_strings(a, b):
    if len(a) > len(b):
        b = '0' * (len(a) - len(b)) + b
    else:
        a = '0' * (len(b) - len(a)) + a
    result = ""
    carry = 0
    for x, y in zip(a[::-1], b[::-1]):
        sum = ord(x) + ord(y) - ord('0')*2 + carry
        result = str(sum % 10) + result
        carry = sum // 10
    if carry:
        result = '1' + result
    return result

print(add_strings("12345", "987654321") == "987666666")