import java.util.StringTokenizer;
import java.io.*;

// ************************ TOKENIZER ***********************************
class Tokenizer {
  //This class is being used to encapsulate a utility, it does not have any
  //objects.  Notice that there are no constructors, just a method called
  //scan.  I have written this class for you because it performs file I/O.
  //The scan method prompts the user for a filename containing the
  //expression to be parsed.  The expression is stored in an array of
  //characters.  The size of expression is determined by maxsize, currently
  //set to 100.  Increase this if you want larger expressions.  There
  //should be no reason why your code should not work on much bigger
  //expressions. 
  private static String fname;
  private static FileInputStream inputData;
  private static int maxSize = 100;
  private static char[] exp = new char[maxSize];

  public static char[] scan(String fname) {
    try {
    inputData = new FileInputStream(fname);
    BufferedReader filein = new BufferedReader(new InputStreamReader(inputData));
//    The next two lines are some ghastly crap that you have to do to read.
      int t = 0, c = 0;
      while ((t < maxSize) && ((c = filein.read(exp, t, maxSize-t)) != -1)) {
        t += c;}

    } catch(IOException exception){
      System.out.println("Input problem. Terminating.");
      System.exit(0);}
    return exp;
  };
}// end Tokenizer
