public void dsf(String s, int[][] p, int i, ArrayList<ArrayList<String>> a,
			ArrayList<String> b) {
		for (int k = i; k < s.length(); k++) {// check each substring after than
												// i
			if (p[i][k] == 1) {// if a substring is palindrome
				b.add(s.substring(i, k + 1)); // add palindrome into temporary
												// list
				// System.out.println(i + ", " + k + ", " + s.substring(i, k +
				// 1));
				dsf(s, p, k + 1, a, b); // go deeper before search neighbors
				if (k == s.length() - 1) { // at the end of the string s;
					ArrayList<String> c = new ArrayList<String>(b); // clone the
																	// temporary
																	// list
					a.add(c); // add cloned list into a
				}
				b.remove(b.size() - 1); // when moving backwards, remove the
										// substrings behind
			}
		}
	}