public HashSet<String> search(String text){

		if(text.length()==0){
			return null;
		}
		int N = text.length(); // input text length
		int skip = 0;
		HashSet<String> termsThatHit = new HashSet<String>();
		// Start of Search
		int i = patternLength;
		for (int count = i; count > 0; count--) {
			int M = pattern[i - count].length();
			for (int k = 0; k <= N - M; k += skip) {
				skip = 0;
				for (int j = M - 1; j >= 0; j--)
					if (pattern[i - count].charAt(j) != text.charAt(k + j)) {
						skip = j - right[i - count][text.charAt(k + j)];
						if (skip < 1)
							skip = 1;
						break;
					}
				if (skip == 0) {
					k = k + 1;
					termsThatHit.add(pattern[i - count]);
					break;
				}
			}
		}
		return termsThatHit;

	}