private static boolean check(HashMap<String, Boolean> wordMap, String word,
			boolean isSub) {
		if (isSub && wordMap.containsKey(word)) { // don't check for the
													// original
													// word, only for sub-words
			System.out.println(word);
			return wordMap.get(word);
		}
		for (int len = 1; len < word.length(); ++len) {
			String sub = word.substring(0, len);
			if (wordMap.containsKey(sub) && wordMap.get(sub)
					&& check(wordMap, word.substring(len), true)) {
				wordMap.put(word, true);
				return true;
			}
		}
		if (isSub) {
			wordMap.put(word, false);
		}
		return false;
	}