import java.io.*;


public class ReadInput {

  public static BufferedInputStream in = new BufferedInputStream(System.in);

  public static String getLine() {
    return tokenize("" + '\n');
  }

  public static String getToken() {
    return tokenize(" " + '\n');
  }

  public static String getWord() {
    return tokenize(" " + '\n');
  }

  public static int getInt() {

    String foo = tokenize(" " + '\n');
    if (foo == null) return 0;
    try {
      return new Integer(foo).intValue();
    }
    catch (java.lang.NumberFormatException e){
      return -1;
    }
  }

  public static void flushLine() {
    while (isMoreStuff()){
      tokenize(" " + '\n');
    }
  }

  public static boolean isMoreStuff() {
    try {
      return (in.available() > 0);
    }
    catch(IOException xcp) { }
    return false;
  }

  private static String tokenize(String whitespace) {
    char ch;
    String token = "";

    try {
      ch = (char)in.read();

      while (!doesContain(whitespace, ch)) {
	token += ch;
	ch = (char)in.read();
      }

      return token;
    }
    catch(IOException xcp) {  }
    return null;
  }

  private static boolean doesContain(String str, char ch) {
    for (int i=0; i < str.length(); i++)
      if (str.charAt(i) == ch) return true; 
    return false;
  }
}
