Compared against declared_pairs · told 6 of 7 deliberately broken copies apart · 1413 ms
def lines(s):
out = []
cur = ''
for ch in s:
if ch == '\n':
out = out + [cur]
cur = ''
else:
cur = cur + ch
if cur != '':
out = out + [cur]
return out
def joinl(xs):
out = ''
first = True
for x in xs:
if first:
out = out + x
first = False
else:
out = out + '\n' + x
return out
def solve(s):
return joinl(sorted(lines(s), reverse=True))
12 test cases ship with it; the first three:
| in | out |
|---|---|
gdqood Wdirk gdqood Zed wdirk0 apple zgqj | zgqj wdirk0 gdqood gdqood apple Zed Wdirk |
ealz Rxjldq ealz Zed rxjldq1 apple oqo | rxjldq1 oqo ealz ealz apple Zed Rxjldq |
yejh Lptc yejh Zed lptc2 apple nnyr | yejh yejh nnyr lptc2 apple Zed Lptc |
GET https://research.zaiba.cloud/api/v1/programs/lines_sorted_desc
POST https://research.zaiba.cloud/api/v1/programs/lines_sorted_desc/run
{"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/lines_sorted_desc/code
# 200 · text/plain · the tool as one Python file, written by the library's authors