import java.util.*;

public class Ordena {
	private Vector words;
	private Vector ordered;
	private boolean foundWord=false;
	private String currentWord,nextWord;
	private int nrCurrentWord,nrNextWord;
	
	public Ordena(Vector words) {
		this.words=words;
		ordered=new Vector();
	}
		
	public Vector sort() {
				
		while (words.size()!=0) {
			nrCurrentWord=0;
			nrNextWord=0;
		  while (true) {
			  foundWord=false;
			  nrCurrentWord=nrNextWord;
		    if (nrCurrentWord<words.size()) {
		  	  // captura palavra atual;
		  	  currentWord=(String)words.elementAt(
		  	  nrCurrentWord);
				  for (nrNextWord=nrCurrentWord+1;
		    	nrNextWord<words.size();nrNextWord++) {
					  // captura proxima palavra a comparar
					  nextWord=(String)words.elementAt(
					  nrNextWord);
					  if (nextWord.compareTo(currentWord)<0) {
						  foundWord=true;
						  break;
					  }
				  }
		    }
		    if (!foundWord) 

		      break;
		  }
		
		  ordered.addElement(currentWord);
			words.removeElementAt(nrCurrentWord);
		}
		
		return ordered;
						
	}			
					
			
}