满分代码如下,如有可改进部分望指正~
def sumP():
input = map(int, raw_input().strip().split(' '))
a = []
d = []
p = []
for i in range(len(input)):
if i % 2 == 0:
a.append(input[i])
else:
d.append(input[i])
for i in range(len(a)):
cc = 0
while a[i] > 10:
if a[i] % 10 == d[i]:
p.append(d[i]*(10**cc))
cc += 1
a[i] = a[i] / 10
if a[i] % 10 == d[i]:
p.append(d[i]*(10**cc))
if cc == 0:
p.append(0)
sum = 0
for i in p:
sum += i
print sum
if __name__ == '__main__':
sumP()