private static int mapCharToInt(Reader input) throws IOException {
        int c;
        while ((c = input.read()) != -1) {
            int result = REVERSE_MAPPING[c];
            if (result != 0) return result - 1;
            if (c == '=') return -1;
        }
        return -1;
    }