//------------// Introduction to Programming Using Java: An Object-Oriented Approach//	Arnow/Weiss//------------// the search method for Vectors// Chapter 10, Section 10.9, Page 423// MODIFICATIONS://    search is made static here so we can test it without creating an object//    main creates a Vector of Strings from input and then tests to see if//	each String can be found in the Vector.import java.io.*;import java.util.*;class TestVectorSearch {	static boolean search(String s) {// Returns true if and only if s equals one 					//       of the Strings in v.		int k;		// k== the index of the next position in 				//       the Vector to check.				// No match has been found in positions 0 				//       through k-1.		k = 0;		while (k!=v.size() && !s.equals(v.elementAt(k)))			k++;		// k==v.size || s.equals(v.elementAt(k))		return k!=v.size();	}	public static void main(String[] a) throws Exception {		boolean fails=false;		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));		v = new Vector();		String line = f.readLine();		String huge = "";		while (line != null) {			huge = huge.concat(line);			v.addElement(line);			line = f.readLine();		}		int k=0;		while (k != v.size()) {			if (!search((String)v.elementAt(k))) {				System.err.println("search failure");				fails = true;			}			k++;		}		if (search(huge)) {			System.err.println("search failure");			fails = true;		}		if (!fails)			System.out.println("search passes these tests");	}	static Vector v;}// Sample test input (no duplicates allowed!)// butter// mustard// ketchup// abc// x// z// antidisestablishmentarianism