import java.io.BufferedInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.Socket;
public class MainClass {
public final static int DEFAULT_PORT = 79;
public static void main(String[] args) throws Exception {
String hostname = "localhost";
Socket connection = null;
connection = new Socket(hostname, DEFAULT_PORT);
Writer out = new OutputStreamWriter(connection.getOutputStream(), "8859_1");
out.write("\r\n");
out.flush();
InputStream raw = connection.getInputStream();
BufferedInputStream buffer = new BufferedInputStream(raw);
InputStreamReader in = new InputStreamReader(buffer, "8859_1");
int c;
while ((c = in.read()) != -1) {
if ((c >= 32 && c < 127) || c == '\t' || c == '\r' || c == '\n') {
System.out.write(c);
}
}
connection.close();
}
}