Convert infix to postfix and vice versa