import java.util.Scanner;
/**
* 将‘l love you ’变成‘you love i’
*
* @author Administrator
*
*/
public class JavaDemo9 {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
reverse(s);
}
public static void reverse(String str){
String[] s1=str.split(" ");
for(int x=s1.length-1;x>-1;x--){
if(x!=0){
System.out.print(s1[x]+" ");
}else{
System.out.print(s1[x]);
}
}
}
}
|
|