import java.lang.System; import java.applet.Applet; import java.io.*; /* takes stdin and outputs decoded od -X information */ public class Decode { public static void main(String[] args) throws java.io.IOException { int firstc=0; int state =0; int br; char ch; boolean done=false; int outind; byte b[]; String s; b = new byte[1]; while (!done) { br=System.in.read(b,0,1); if (br == -1) done=true; else { s = new String(b,0); ch = s.charAt(0); switch(state) { case 0: if (ch == ' ') state = 1; break; case 1: if (ch == '\n') state=0; else if ( ch == ' ') state=1; /* same state */ else { firstc=Character.digit(ch,16); if (firstc == -1) { System.err.println("Input Error on (first) Character: "+ch); state=0; } else state=2; } break; case 2: if (ch == '\n' || ch == ' ') { System.err.println("Input Error (was looking for second char)..."); state =0; } else { if (-1 == Character.digit(ch,16)) { System.err.println("Input Error on Character (second char, not digit): "+ch); state=0; } else { outind=firstc*16+Character.digit(ch,16); /*System.out.print(list[outind]);*/ System.out.print((char)outind); state=1; } } break; } /* switch*/ } /* else */ } /* while*/ System.out.flush(); } /* main*/ } /* Decode */