public String nextWord() throws IOException {
        String res = null;
        if (matcher != null) {
            while (res == null) {
                if (matcher.find()) {
                    res = matcher.group(1);
                } else if (reader.ready()) {
                    matcher = pattern.matcher(reader.readLine());
                } else {
                    break;
                }
            }
        }
        return res == null ? null : res.toLowerCase();
    }