#!/usr/local/bin/chicken-csi -ss (import (chicken io) srfi-1) ; delete-duplicates (define (last-len-uniq? s i len) (and (>= i len) (equal? len (length (delete-duplicates (string->list (substring s (- i len) i))))))) (define (str-find-idx s len-uniq) (let ((n (string-length s))) (let loop ((i 0)) (if (>= i n) #f (if (last-len-uniq? s i len-uniq) i (loop (add1 i))))))) (define (main args) (let ((input (read-line))) (print (str-find-idx input 4)) (print (str-find-idx input 14))))