18 lines
409 B
Python
18 lines
409 B
Python
import os
|
|
|
|
if (os.path.isfile("./input")):
|
|
input = open("./input", "r").read()
|
|
else:
|
|
input = "987654321111111\n811111111111119\n234234234234278\n818181911112111\n"
|
|
|
|
r = 0
|
|
for bat in input.split('\n'):
|
|
if (bat == ""):
|
|
break
|
|
for i in reversed(range(12)):
|
|
m = max(bat[:(len(bat) if i == 0 else -i)])
|
|
r += int(m) * 10**i
|
|
bat = bat[bat.index(str(m)) + 1:]
|
|
|
|
print(r)
|