public void add(String word) {
            char[] wordChars = word.toCharArray();
            for (int i = 0; i < wordChars.length; i++) {
                char before = wordChars[i];
                wordChars[i] = (char) 0;
                String key = String.valueOf(wordChars);

                HashSet<String> valueSet = graph.get(key);
                if (valueSet == null) {
                    valueSet = new HashSet<String>();
                    graph.put(key, valueSet);
                }
                valueSet.add(word);

                wordChars[i] = before;
            }
        }