; jumble

(define (jumble target)
  (let ((target (sort (string->list target) char<?)))
    (let loop ((word (read)))
      (unless (eof-object? word)
        (let ((signature (sort (string->list (symbol->string word)) char<?)))
          (if (equal? target signature) word (loop (read))))))))

(display (jumble "lteade")) (newline)
(display (jumble "abcdef")) (newline)