/**
*
* - Purpose:
*
- Model answer to Q3.6.
*
*
- Description:
*
- Reads in a String, splits it into words and
* output each word on a separate line in reverse order.
*
*
*
* @author Richard Akester
* @version $Date: 2005/10/27$
*
*/
public class ReverseSplitWords
{
public static void main(String[] args)
{
KeyboardInput k = new KeyboardInput();
String s = k.readString();
int i=s.length(), endOfWord;
do {
do {
if(--i<0) System.exit(0);
} while(Character.isWhitespace(s.charAt(i)));
endOfWord=i;
do {
if(--i<0) break;
} while(!Character.isWhitespace(s.charAt(i)));
System.out.println(s.substring(i+1,endOfWord+1));
} while(true);
}
}