Skip to content

Instantly share code, notes, and snippets.

@rkdgusrnrlrl
Last active July 13, 2021 10:14
Show Gist options
  • Save rkdgusrnrlrl/4416923f89ed7c1cb32c3002bfe06e4a to your computer and use it in GitHub Desktop.
Save rkdgusrnrlrl/4416923f89ed7c1cb32c3002bfe06e4a to your computer and use it in GitHub Desktop.
import sys
if __name__ == "__main__":
f_str = [ss for ss in sys.argv[1]]
f_str.reverse()
s_str = [ss for ss in sys.argv[2]]
s_str.reverse()
long_str = f_str
short_str = s_str
if len(s_str) > len(f_str):
long_str = s_str
short_str = f_str
result_str = ''
is_exist_next_one = False
for ii in range(len(long_str)):
ord_num = 0
if is_exist_next_one:
ord_num += 1
is_exist_next_one = False
if ii >= len(short_str):
ord_num += ord(long_str[ii])
else:
ord_num += ord(long_str[ii]) + ord(short_str[ii]) - 48
if ord_num >= 58:
ord_num = ord_num - 10
is_exist_next_one = True
result_str = chr(ord_num) + result_str
print(result_str)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment