

class Oct13 {

	public static void main(String[] args) {
	
		String[] d = { "one", "two", "tree", "four" };
		String[] o = { "two", "four" };

		String[] r = filter(d, o);
		
		for(String elm : r) {
			System.out.printf("%s ", elm);
		}
		System.out.println();
	}

	// returns an array of the strings in data that are 
	// not in omit

	static String[] filter(String[] data, String[] omit) {
		String[] temp = new String[data.length];
		int counter = 0;

		for(int i = 0; i < data.length; i++) {
			String curString = data[i];
			boolean notFound = true;
			for(int j = 0; j < omit.length; j++) {
				if (curString.equals(omit[j])) {
					notFound = false;
					break;	
				}
			}
			// match not found
			if (notFound == true) {
				temp[counter] = curString;
				counter++;
			}
		}	

		String[] results = new String[counter];
		for(int i = 0; i < results.length; i++) {
			results[i] = temp[i];
		} 
		
		return results;
	}

}
