Compared against declared_pairs · told 7 of 7 deliberately broken copies apart · 1449 ms
def solve(s):
cells = []
word = ''
for ch in s + ' ':
blank = ch == ' ' or ch == '\n' or ch == '\t'
if blank:
if word != '':
cells = cells + [word]
word = ''
else:
word = word + ch
table = '| field |' + '\n' + '| --- |'
for word in cells:
table = table + '\n' + '| ' + word + ' |'
return table
12 test cases ship with it; the first three:
| in | out |
|---|---|
ffqe zewb ffqe qyutkm 0 | | field | | --- | | ffqe | | zewb | | ffqe | | qyutkm | | 0 | |
jxq iieg jxq tinhy 1 | | field | | --- | | jxq | | iieg | | jxq | | tinhy | | 1 | |
gxxzab zleiyo gxxzab jie 2 | | field | | --- | | gxxzab | | zleiyo | | gxxzab | | jie | | 2 | |
GET https://research.zaiba.cloud/api/v1/programs/text_to_markdown_table
POST https://research.zaiba.cloud/api/v1/programs/text_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/text_to_markdown_table/code
# 200 · text/plain · the tool as one Python file, written by the library's authors