You can use another switch, or just create tables:

encode[] = {'a', 'b', 'c', 'd'};
decode[] = {'l', 'j', 'g', 'w'};

Instead of using switch statements, you just scan your tables until you hit the index you want and use the other table to encode/decode.