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 = []
for l in lines(s):
i = 0
while i < len(l) and l[i] in '0123456789':
i = i + 1
rest = l
if i > 0 and i < len(l) and l[i] == '.':
j = i + 1
while j < len(l) and l[j] == ' ':
j = j + 1
rest = l[j:]
out = out + [rest]
return joinl(out)
8 test cases ship with it; the first three:
| in | out |
|---|---|
1. eab 2. hufye dqvm 10. 0 | eab hufye dqvm 0 |
1. wxz 2. piuyaz ypsn 10. 1 | wxz piuyaz ypsn 1 |
1. vgdzcx 2. pyq xrval 10. 2 | vgdzcx pyq xrval 2 |
GET https://research.zaiba.cloud/api/v1/programs/lines_unnumbered
POST https://research.zaiba.cloud/api/v1/programs/lines_unnumbered/run
{"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/lines_unnumbered/code
# 200 · text/plain · the tool as one Python file, written by the library's authors