A catalog tool: listed by construction. A tool built for a request carries the report of its own admission here.
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(set(lines(s))))
8 test cases ship with it; the first three:
| in | out |
|---|---|
eab hufye eab dqvm hufye 0 | 0 dqvm hufye eab hufye |
wxz piuyaz wxz ypsn piuyaz 1 | 1 piuyaz wxz ypsn piuyaz |
vgdzcx pyq vgdzcx xrval pyq 2 | 2 pyq vgdzcx xrval pyq |
GET https://research.zaiba.cloud/api/v1/programs/lines_sorted_unique
POST https://research.zaiba.cloud/api/v1/programs/lines_sorted_unique/run
{"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/lines_sorted_unique/code
# 200 · text/plain · the tool as one Python file, written by the library's authors