Not done any java in a few years now but quickly came up with this:
Code:
import java.io.*;
public class Main
{
public static void main(String[] args)
{
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(reader);
try
{
String inWord = in.readLine();
String words[] = inWord.split(" ");
if(words.length == 3)
{
System.out.print(words[2]);
System.out.print(" ");
System.out.print(words[1]);
System.out.print(" ");
System.out.println(words[0]);
}
else if(words.length > 3)
{
System.out.println("You entered more than 3 words.");
}
else
{
System.out.println("You entered less than 3 words.");
}
}
catch(IOException e)
{
System.out.println("IO exception: ");
System.out.println(e.getMessage());
}
}
}
Hope that helps