public static boolean check(String query, String pattern) {
		String[] queries = query.split(" "); // split
		String[] patterns = pattern.split(" "); // split
		String wholePattern = new String("");
		for (int i = 0; i < patterns.length; i++) {
			wholePattern += patterns[i];
		}
		System.out.println(query+"\r\n"+pattern+"\r\n");
		System.out.println(wholePattern.contains(query));
		if (wholePattern.contains(query)) return true;
		int i = 0;
		int j = 0;
		while (i < queries.length) {
			int check = 0;
			while (j < patterns.length) {
				if (patterns[j].length() >= queries[i].length() && (patterns[j].substring(0, queries[i].length())).equals(queries[i])) {
					j += 1;
					check = 1; // matched
					break;
				} else { // not matched
					j += 1;
				}
			}
			if (check == 1)
				i += 1;
			if (j == patterns.length) break;
		}
		if (i == queries.length) return true;
		else return false;
	}