Baseline: tree as shared

This commit is contained in:
alexm committed 2026-10-05 03:03:38 +00:00
commit 31f2fb8a5a
1679 files changed
+1024562

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
# probe: shifting letters through an alphabet string with find()
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
# expect-stdout: khoor zruog
# expect-stdout: hello world
# expect-stdout: bcd
def shift(s: String, k: Int) -> String:
var alphabet = String("abcdefghijklmnopqrstuvwxyz")
var out = String("")
for i in range(s.count_codepoints()):
var c = String(s[codepoint=i])
var at = alphabet.find(c)
if at < 0:
out += c
else:
out += String(alphabet[codepoint=(at + k) % 26])
return out
def main():
var secret = shift("hello world", 3)
print(secret)
print(shift(secret, 23))
print(shift("xyz", 4))