Compared against declared_pairs · told 12 of 12 deliberately broken copies apart · 1578 ms
def solve(s):
bag = []
piece = ''
for ch in s + '\n':
if ch in '0123456789':
piece = piece + ch
elif ch == '-' and piece == '':
piece = piece + ch
elif ch == '.' and piece != '' and piece != '-' and '.' not in piece:
piece = piece + ch
else:
if piece != '' and piece != '-' and piece != '.' and piece != '-.':
bag = bag + [piece]
piece = ''
body = ''
started = False
for piece in bag:
if started:
body = body + ','
body = body + piece
started = True
return '[' + body + ']'
12 test cases ship with it; the first three:
| in | out |
|---|---|
69 -9 22 69 9.5 x9 69-22 0 | [69,-9,22,69,9.5,9,69,22,0] |
40 -5 68 40 5.5 x5 40-68 1 | [40,-5,68,40,5.5,5,40,68,1] |
11 -6 37 11 6.5 x6 11-37 2 | [11,-6,37,11,6.5,6,11,37,2] |
GET https://research.zaiba.cloud/api/v1/programs/numbers_to_json
POST https://research.zaiba.cloud/api/v1/programs/numbers_to_json/run
{"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/numbers_to_json/code
# 200 · text/plain · the tool as one Python file, written by the library's authors