(use scheme.vector) (use gauche.collection) (let* ((n (read))) (define vec (vector-map char->integer (string->vector (number->string n)))) (print (apply max #?=(let loop ((is (iota (vector-length vec)))) (cond ((null? is) '()) (else (let1 vec-copied (vector-copy vec) (vector-swap! vec-copied 0 (car is)) (cons (string->number (list->string (map integer->char vec-copied))) (loop (cdr is))))))))))