<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package martin;

import java.io.Reader;
import java.io.IOException;

public final class Parse {
	private Parse(){}
	public static String read(Reader in) throws IOException{
		String tmp = "";
		char c=0;
		do {
			c = (char)in.read();
			tmp += c;
		}while(c!=' ' &amp;&amp; c!='\n' &amp;&amp; in.ready());

		return tmp.replaceAll(" ","").replaceAll("\n", "");
	}

	public static void expect(Reader in, String str) throws IOException, Exception{
		if (!read(in).equals(str))
			throw new Exception("expected " + str);
	}

	public static void expect(Reader in, char c) throws IOException, Exception{
		if ((char)in.read() != c)
			throw new Exception("expected " + c);
	}

	public static int readInt(Reader in) throws NumberFormatException, IOException{
		return Integer.parseInt(read(in));
	}

	public static double readDouble(Reader in) throws NumberFormatException, IOException{
		return Double.parseDouble(read(in));
	}
}
</pre></body></html>