summaryrefslogtreecommitdiff
path: root/problem79.ijs
blob: 58ffe634c17706ec13cb411333981fa6657b9994 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
notBlocked =: {{
	first =. x={.y
	notThere =. -.x e. y
	first +. notThere
}}

nextChar =: {{
	*./;x notBlocked each y
}}"0 1

solve =: {{
	result =. ''
	data =. 'b' fread 'p079_keylog.txt'
	chars =. ~.;data
	while. 0<#chars do.
		ch =. {.chars{~I. chars nextChar data
		result =. result,ch
		removeCh =. ch&(~:#])
		chars =. removeCh chars
		data =. removeCh each data
	end.
	result
}}

problem79 =: solve ''