![]() |
git.alexw.nyc | home | about | git | garden |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | f<< /aoc/core.fs f" /aoc/input" : +k ( a b -- c b ) tuck + swap ; : cinstr ( c a u -- f ) rfor dup i c@ = if 1 nip break then next 1 = ; : finditem ( s -- c ) >r V1 c@+ >> rfor i c@ V1 c@+ >> +k cinstr if i c@ break then next rdrop ; : points ( c -- ) dup 'a' >= if 96 - else 38 - then ; 0 value total : solvea 0 begin file :readline ?dup while finditem points to+ total repeat total . ; |