The printable ASCII characters (hex codes 20 to 7E) in order are:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
(Note that space is in there.)
This string clearly contains all the printable ASCII characters at least once in increasing order when read from left to to right, but not in decreasing order.
The string reversed:
~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! NORMAL: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
contains all the printable ASCII characters at least once both in increasing and decreasing order. In other words, when the characters are valued with their numeric code, the longest increasing and longest decreasing subsequences have length 95 (the number of printable ASCII characters).
Challenge
Choose a contiguous subset of N printable ASCII characters, such as LMNOP
(N = 5). Write a program using only those N characters whose output contains all 95 ASCII characters in increasing and decreasing order like the example above.
The winner is the submission with the lowest N. In case of ties the shortest code in bytes wins.
Notes
- A contiguous subset means a set of the printable ASCIIs that all appear in an unbroken line, such as
LMNOP
or89:;<=>
. - Your contiguous subset may "loop around" from
~
to space, but this incurs a +3 penalty on N. So{|}~
has N = 4, but{|}~ !
has N = 6 + 3 = 9. - Your program may only contain the N printable ASCII characters from the contiguous subset you've selected. They do not all have to appear and may appear multiple times in any order. (All non-printable ASCII and all non-ASCII is not allowed. This means tabs and newlines are not allowed.)
- Your output may only contain printable ASCII characters and must be less than 10000 characters long.
- Your output's longest increasing and decreasing subsequences must both have length 95 (as explained above).
- Output to stdout. There is no input.
- N is a positive integer less than 96.