I have a string that has three letters, 1, 2, X. Sometimes the string can be 12, or 1X, or 2X..etc.
I would like to append a "-" based on the position of the input letters. For example If I get 1, the result should be 1--, If I get X, the results should --X, If I get 2X, the result should be -2X.
My approach is to use a state machine of 2^n selections, but I'm looking for a smart apporach and better apporach.
More examples
Input 1 2 X 2X
Ouput 1-- -2- --X -2X