I am supposed to make a custom decorator so I can replace both in an input from console and from a file:
char[
DjMike,
For the second one, what would be helpful during the replacement is to call a method that you infuse with the logic to replace different characters with different strings.
PHP has a great facility that does just this called preg_replace_callback(). The linked answer is to a question about the Java equivalent of preg_replace_callback()