This is the java code and the standard in file I had to read from.