public String simplifyPath(String path) {
		if (path.length() < 1)
			return "";
		StringBuilder curDir = new StringBuilder();
		StringBuilder ressb = new StringBuilder();
		LinkedList<String> allDirs = new LinkedList<String>();
		// Ensure traverse will be terminated by encountering slash
		path += '/';
		for (int i = 0; i < path.length(); i++) {
			if (path.charAt(i) == '/') {
				if (curDir.length() == 0)
					continue;
				else if (curDir.toString().equals("."))
					curDir.setLength(0);
				else if (curDir.toString().equals("..")) {
					if (!allDirs.isEmpty())
						allDirs.pop();
					curDir.setLength(0);
				} else {
					allDirs.push(curDir.toString());
					curDir.setLength(0);
				}
			} else {
				curDir.append(path.charAt(i));
			}
		}
		// Note that pop / push happens on head of linked list, so need to append strings in reverse order
		for (int i = allDirs.size() - 1; i >= 0; i--) {
			ressb.append("/" + allDirs.get(i));
		}
		// If nothing in allDirs, return "/"
		if (ressb.length() == 0)
			ressb.append("/");
		return ressb.toString();
	}