about summary refs log tree commit diff
path: root/day5.k
blob: 09fef93d0462c6c2b710edc9bd9c9ece8b0f181c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
d:0:"day5";

r1: {2<#&5>"aeiou"?/:x}; / three vowels
r2: {0<#&=':x}; / two consecutive letters
r3: {~#,/x _ss ("ab";"cd";"pq";"xy")}; / no ab/cd/pq/xy

#&(r3'd)&(r2'd)&(r1'd)

bg: {[s]{x;2#(x-1) _ s}'1+!#s}; / bigrams

r4: {0<#&1<#:' x _ss ?bg x}; / duplicate bigram
r5: {0<#&(-2_ x)=(2_ x)}; / matches (.).\1

#&(r4'd)&(r5'd)