Write a program that takes as its input a string consisting of printable characters (ASCII 20-7E) and an integer
n in [2,16] and performs the following modification to the string.
- Each character in the string is converted to its ASCII code (the examples given are in hexadecimal, though base 10 is also acceptable).
- The ASCII codes are converted to base
nand are concatenated together.
- The new string is split every other character. If there are an odd number of characters, then the last character is removed entirely.
- Printing ASCII codes (in base 16) are converted back into their characters, whereas non-printing ASCII codes are removed.
- The resulting string is printed.
Hello, World! 6
Hello, World! 48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21 2002453003003031125222330331030024453 20 02 45 30 03 00 30 31 12 52 22 33 03 31 03 00 24 45
The output of this program is
This is code golf, so standard rules apply. Shortest code in bytes wins.