Odin SolutionsOdin Solutions
🧑🚀
A Human Message
Week 4, 2026
All SolutionsWalking string and making runes | greenya | Odin Solutions
// https://program52.com/en/challenge/2026/5B7BB05B5
// - use "odin run ." to run the code
// - input1.txt and input2.txt should be nearby with the input data
package main
import "core:fmt"
import "core:strconv"
import "core:strings"
input1_bytes := #load("input1.txt")
input2_bytes := #load("input2.txt")
main :: proc () {
for bytes in ([2] [] byte { input1_bytes, input2_bytes }) {
text := strings.trim(string(bytes), "\n\r\t ")
for line in strings.split_lines(text) {
result := decode(line)
fmt.printfln("->|%s|\n<-|%s|", line, result)
}
}
}
decode :: proc (input: string, allocator := context.allocator) -> string {
assert(len(input)%8 == 0, "input length must be divisible by 8")
sb := strings.builder_make(allocator)
for i in 0..<len(input)/8 {
text := input[i*8:(i+1)*8]
number, ok := strconv.parse_int(text, base=2)
assert(ok)
strings.write_rune(&sb, rune(number))
}
return strings.to_string(sb)
}