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):
out = []
n = 1
for l in lines(s):
out = out + [str(n) + '. ' + l]
n = n + 1
return joinl(out)
8 test cases ship with it; the first three:
| in | out |
|---|---|
eab Hufye eab Zed hufye0 apple dqvm | 1. eab 2. Hufye 3. eab 4. Zed 5. hufye0 6. apple 7. dqvm |
wxz Piuyaz wxz Zed piuyaz1 apple ypsn | 1. wxz 2. Piuyaz 3. wxz 4. Zed 5. piuyaz1 6. apple 7. ypsn |
vgdzcx Pyq vgdzcx Zed pyq2 apple xrval | 1. vgdzcx 2. Pyq 3. vgdzcx 4. Zed 5. pyq2 6. apple 7. xrval |
GET https://research.zaiba.cloud/api/v1/programs/lines_numbered
POST https://research.zaiba.cloud/api/v1/programs/lines_numbered/run
{"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/lines_numbered/code
# 200 · text/plain · the tool as one Python file, written by the library's authors