华为笔试第一题为什么本地通过上交不能AC
import sys
def largestTimeFromDigits(A):
A.sort()
for h in range(23, -1, -1):
for m in range(59, -1, -1):
for sec in range(59, -1, -1):
t = [h // 10, h % 10, m // 10, m % 10,sec //10, sec%10]
ts = sorted(t)
if ts == A:
return str(t[0]) + str(t[1]) + ":" + str(t[2]) + str(t[3])+ ":" + str(t[4]) + str(t[5])
return "invalid"
line = sys.stdin.readline().strip()
num = list(map(int, line.strip().split(",")))
print(largestTimeFromDigits(num))
#华为##笔试题目##春招#