USING: io.encodings.ascii io.files kernel math math.distances parser prettyprint regexp sequences ; "input23.txt" ascii file-lines [ R/ -{,1}\d+/ all-matching-subseqs [ parse-number ] map ] map [ [ last ] supremum-by ] keep [ [ unclip-last swap ] dip 3 head manhattan-distance >= ] with count .