q/k4 (3? 5? 8?)
if it's sufficient to enter the code and the input directly into the REPL, it's just
q)asc"Johnny walked the dog to the park."
`s# is bit of q notation that indicates that the string is in sorted order (can be binary searched, etc.). if it has to go, that costs two characters, making five:
q)`#asc"Johnny walked the dog to the park."
if you want it provided on stdin, it's time to switch to k4 (and we get rid of the
`s# for free), and it's an eight-character solution:
Johnny walked the dog to the park.
that one, btw, will work as a code file exactly as is (still eight characters, since q is fine with not having the final newline in a code file). normally there would be issues with a welcome banner and with the REPL staying open, but if you pass the input as a herestring, all that goes away:
$ cat asc.k
$ q asc.k<<<'Johnny walked the dog to the park.'
not actually sure where that extra newline in the output is coming from....