ArrayList<Stack<String>> join(boolean[][] res, int begin, String s,
			HashMap<Integer, ArrayList<Stack<String>>> dp) {
		int n = s.length();
		ArrayList<Stack<String>> resArr = new ArrayList<Stack<String>>();
		if (begin == n) {
			resArr.add(new Stack<String>());
			return resArr;
		}
		if (dp.containsKey(begin))
			return dp.get(begin);
		for (int i = begin; i < n; i++) {
			if (res[begin][i]) {
				ArrayList<Stack<String>> arr = join(res, i + 1, s, dp);
				String str = s.substring(begin, i + 1);
				for (Stack<String> sta : arr) {
					Stack<String> tmp = (Stack<String>) sta.clone();
					tmp.push(str);
					resArr.add(tmp);
				}
			}
		}
		dp.put(begin, resArr);
		return resArr;
	}