import java.util.Scanner; public class mirror { /** * @param args */ public static void main(String[] args) { Scanner s = new Scanner(System.in); while(true) { char[] st = s.nextLine().toCharArray(); if (st[0] == '#') break; boolean suc = true; for (int i = 0; i < st.length; i++) { if (st[i] == 'b') st[i] = 'd'; else if (st[i] == 'd') st[i] = 'b'; else if (st[i] == 'p') st[i] = 'q'; else if (st[i] == 'q') st[i] = 'p'; else if (st[i] != 'i' && st[i] != 'o' && st[i] != 'v' && st[i] != 'w' && st[i] != 'x') { suc = false; break; } } if (suc) { for (int i = st.length - 1; i >= 0; i--) System.out.print(st[i]); System.out.println(); } else System.out.println("INVALID"); } } }