Compared against declared_pairs · told 9 of 9 deliberately broken copies apart · 1640 ms
def solve(s):
words = []
cur = ''
i = 0
u = s + ' '
while i < len(u):
ch = u[i]
i = i + len(ch)
if ch == ' ' or ch == '\n' or ch == '\t':
if len(cur) > 0:
words = words + [cur]
cur = ''
else:
cur = cur + ch
xs = sorted(set(words))
out = ''
j = 0
m = len(xs)
while j < m:
if j == 0:
out = xs[j]
else:
out = out + ',' + xs[j]
j = j + len(',')
return out
12 test cases ship with it; the first three:
| in | out |
|---|---|
jgxff ioon jgxff zzpjj 0 | 0,ioon,jgxff,zzpjj |
yzj pgq yzj ckdw 1 | 1,ckdw,pgq,yzj |
axlvha dte axlvha adq 2 | 2,adq,axlvha,dte |
GET https://research.zaiba.cloud/api/v1/programs/sorted_unique_words_csv
POST https://research.zaiba.cloud/api/v1/programs/sorted_unique_words_csv/run
{"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/sorted_unique_words_csv/code
# 200 · text/plain · the tool as one Python file, written by the library's authors