Java Skeleton Code
Here is a "skeleton code" file that can be used for your programs (obviously
you will need to modify it to read the input for the particular problem that
you're working on).
Important Note: Recall that according to the directions on
the UVA website, your program must read the input from standard input
and write results to standard output.
import java.io.*; import java.util.*; import java.lang.*; class Main { static String ReadLn(int maxLg) // utility function to read from stdin { byte lin[] = new byte [maxLg]; int lg = 0, car = -1; String line = ""; try { while (lg < maxLg) { car = System.in.read(); if ((car < 0) || (car == '\n')) break; lin [lg++] += car; } } catch (IOException e) { return (null); } if ((car < 0) && (lg == 0)) return (null); // eof return (new String(lin, 0, lg)); } public static void main (String [] args) { new MyClass(); } } class MyClass { public MyClass() { String input; while ((input = Main.ReadLn(255)) != null) { // ** INSERT YOUR CODE HERE } } }