Can you show me your JAVA template with read/write functions?
import java.io.*;
import java.util.*;
class Scanner {
InputStream in;
char word[] = new char[4];
char c;
Scanner(InputStream in) {
this.in = in;
nextChar();
}
void asserT(boolean e) {
if (!e) {
throw new Error();
}
}
void nextChar() {
try {
c = (char)in.read();
} catch (IOException e) {
throw new Error(e);
}
}
void skipSpace() {
while (c == ' ' || c == '\r' || c == '\n') {
nextChar();
}
}
char[] next() {
skipSpace();
int pos = 0;
while ('A' <= c && c <= 'Z') {
word[pos] = c;
pos++;
nextChar();
}
asserT(pos > 0);
while (pos < 4) {
word[pos] = 0;
pos++;
}
return word;
}
int nextInt() {
skipSpace();
asserT('0' <= c && c <= '9');
int value = 0;
while ('0' <= c && c <= '9') {
int digit = c - '0';
asserT(value <= (Integer.MAX_VALUE - digit) / 10);
value *= 10;
value += digit;
nextChar();
}
return value;
}
}
class PrintWriter {
OutputStream out;
int digits[] = new int[10];
PrintWriter(OutputStream out) {
this.out = out;
}
void println(int value) {
try {
int pos = 0;
do {
digits[pos] = '0' + value % 10;
pos++;
value /= 10;
} while (value > 0);
while (pos > 0) {
pos--;
out.write(digits[pos]);
}
out.write('\r');
out.write('\n');
} catch (IOException e) {
throw new Error(e);
}
}
void close() {
try {
out.close();
} catch (IOException e) {
throw new Error(e);
}
}
}