package FileSystem; import java.util.*; import java.io.*; // A class that generates lines from the input. You need not modify this file. public class InputSource { private BufferedReader in; private String prompt; public InputSource ( ) { try { in = new BufferedReader (new InputStreamReader (System.in)); } catch (Exception e) { System.err.println ("Couldn't access keyboard!"); System.exit (1); } prompt = "> "; } public InputSource (String fileName) { try { in = new BufferedReader (new InputStreamReader (new FileInputStream (fileName))); } catch (Exception e) { System.err.println ("Couldn't access file!"); System.exit (1); } prompt = ""; } // Return the tokens on the next line. // Tokens are delimited by whitespace. // A null result means no more input; // a blank line is represented by a zero-element token array. public String [ ] nextLine ( ) { String line = ""; System.out.print (prompt); try { line = in.readLine ( ); } catch (IOException e) { System.err.println ("input error"); System.exit (1); } if (line == null) { return null; } StringTokenizer tokens = new StringTokenizer (line); String [ ] toReturn = new String [tokens.countTokens ( )]; int k=0; while (tokens.hasMoreElements ( )) { toReturn[k] = (String) tokens.nextElement ( ); k++; } return toReturn; } public static void main (String [ ] args) { InputSource in; if (args.length == 0) { in = new InputSource ( ); } else { in = new InputSource (args[0]); } String [ ] strings; while (true) { strings = in.nextLine ( ); if (strings == null) { System.exit (0); } for (int k=0; k