public String nextTerm(StringReader reader) throws IncorrectQueryException {
            String STOP_SYMBOLS = ".,;:()!@#$%^&*[]{}\'\"`~";
            try {
                buffer.delete(0, buffer.length());
                int c = 0;

                while ((c = reader.read()) != -1) {
                    if (STOP_SYMBOLS.lastIndexOf(c) != -1) {
                        throw new IncorrectQueryException();
                    }
                    if (Character.isWhitespace(c)) {
                        return buffer.toString();
                    }
                    buffer.append((char)c);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            return buffer.toString();
        }