先將輸入字串用list()轉換成串列,偵測偶數項和奇數項加總相減
s = input()
s = list(s)
for i in range(len(s)):
s[i] = int(s[i])
a = 0
b = 0
if (i%2) != 0:
a += s[i]
else:
b += s[i]
print(abs(a-b))