Odin SolutionsOdin Solutions
🏚️
Halfway House
Week 26, 2026
All SolutionsSplit by spaces and read pairs | greenya | Odin Solutions
package main
import "core:fmt"
import "core:strings"
INPUT :: `'91#08A$ B*$E>/45<8,G $K$B 1</J &F!@=1-:P%?"(?@% #J05*7)E,G B2!G8- 3918C*63"R6= %J/7 -@8A #TN!D.K!*:2. <B *"%P!C3DD%C$ 2%81A33A52-8H&!RK)C"/:3;`
main :: proc () {
fmt.println(decode(INPUT))
}
decode :: proc (s: string, allocator := context.allocator) -> string {
s := s
sb := strings.builder_make(allocator)
for part in strings.split_iterator(&s, " ") {
assert(len(part)%2==0)
if strings.builder_len(sb) > 0 {
strings.write_byte(&sb, ' ')
}
for i:=0; i<len(part); i+=2 {
strings.write_byte(&sb, part[i] + part[i+1])
}
}
return strings.to_string(sb)
}