public String next() {
        String s = "";

        try {
            char read = (char) input.read();
            while (read == ' ' || read == '\n') {
                read = (char) input.read();
                if (read == END_CHARACTER) {
                    endOfFile = true;
                    return s; //if the final character is found, then return this.
                }
            }
            while (read != ' ' && read != ',' && read != '\n') {
                s += read;
                read = (char) input.read();
                if (read == END_CHARACTER) {
                    endOfFile = true;
                    return s; //if the final character is found, then return this.
                }
            }
            
        } catch (IOException ioe) {
            ioe.printStackTrace();
            System.out.println("IOException: the file is not found");
            System.exit(-1);
        }
        return s;
    }