blob: f95ea2e2b93e74cbbd134066cee711203ea4b077 (
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
26
27
28
29
30
31
32
33
34
35
36
37
|
;;; https://gitlab.com/Syndamia/senzill
(require :senzill)
(use-package :senzill.collections)
;;; After loading this file, if you enter a blank line, code will work on each
;;; line of input, until "end" is typed.
;;; Otherwise, the input is taken as a filename and code will be executed
;;; over each line in the file until EOF.
(defvar *prog-input*)
(let ((ui (read-line)))
(if (equal ui "")
(setq *prog-input* *standard-input*)
(setq *prog-input* (open ui))))
(defconstant +process-characters+ 4)
(let
((inpt (read-line *prog-input* NIL)) (met '()) (sop -1))
(loop until (or (string= inpt "end") (not inpt)) do
(loop for i from 0 to (- (length inpt) 1)
until (> sop 0) do
(loop until (not (find (char inpt i) met)) do
(pop-back met))
(push (char inpt i) met)
(if (= (length met) +process-characters+)
(setq sop (+ 1 i))))
(setq inpt (read-line *prog-input* NIL)))
(print sop))
(if (not (eq *prog-input* *standard-input*))
(close *prog-input*))
|