Initial commit
Test (in pplus-core) / in-core (push) Failing after 28m44s

This commit is contained in:
alexm committed 2026-11-12 22:23:48 -05:00
commit 568474d52f
1591 files changed
+528213

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
# probe: run-length encoding a string
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
# expect-stdout: aaabccdddd -> 3a1b2c4d
# expect-stdout: abc -> 1a1b1c
# expect-stdout: ->
# expect-stdout: zzzzzzzzzz -> 10z
def encode(s: String) -> String:
var out = String("")
var n = s.count_codepoints()
var i = 0
while i < n:
var c = String(s[codepoint=i])
var run = 1
while i + run < n and String(s[codepoint=i + run]) == c:
run += 1
out += String(run) + c
i += run
return out
def main():
for s in ["aaabccdddd", "abc", "", "zzzzzzzzzz"]:
print(s, "->", encode(s))