Compared against declared_pairs · told 4 of 4 deliberately broken copies apart · 1353 ms
def solve(s):
rows = []
cur = ''
i = 0
text = s + '\n'
n = len(text)
while i < n:
ch = text[i]
if ch == '\n':
rows = rows + [cur]
cur = ''
else:
cur = cur + ch
i = i + len(ch)
res = '| line |'
sep = '\n| --- |'
res = res + sep
j = 0
m = len(rows)
while j < m:
cell = rows[j]
res = res + '\n| ' + cell + ' |'
j = j + len('\n')
return res
12 test cases ship with it; the first three:
| in | out |
|---|---|
wjivo Cwkhk wjivo Zed cwkhk0 apple dfba | | line | | --- | | wjivo | | Cwkhk | | wjivo | | Zed | | cwkhk0 | | apple | | dfba | |
hsr Ont hsr Zed ont1 apple nuit | | line | | --- | | hsr | | Ont | | hsr | | Zed | | ont1 | | apple | | nuit | |
rlve Ugu rlve Zed ugu2 apple qtlwr | | line | | --- | | rlve | | Ugu | | rlve | | Zed | | ugu2 | | apple | | qtlwr | |
GET https://research.zaiba.cloud/api/v1/programs/int_to_markdown_table
POST https://research.zaiba.cloud/api/v1/programs/int_to_markdown_table/run
{"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/int_to_markdown_table/code
# 200 · text/plain · the tool as one Python file, written by the library's authors