C++版单词反转 给出一个英语句子,希望你把句子里的单词顺序都翻转过来

题目描述 Description
给出一个英语句子,希望你把句子里的单词顺序都翻转过来

输入描述 Input Description
输入包括一个英语句子。

输出描述 Output Description
按单词的顺序把单词倒序输出

样例输入 Sample Input
I love you

样例输出 Sample Output
you love I

数据范围及提示 Data Size & Hint
简单的字符串操作

简单对一个句子(String) 以 空格 做分隔数组,然后倒序。
当然做的好一点, 句子中以及结尾的标点符号。

JAVA 实现 做个引子:

  `Scanner input = new Scanner(System.in);
    System.out.println("请输入一句英文:input ->> ");
    String str = input.nextLine();
    System.out.println("翻译过后的英文:output -<< ");
    if(!("".endsWith(str) || str == null)){
        String [] strs = str.split(" ");
        for (int i = 0, len = strs.length; i < len; i++) {
            System.out.print(strs[len-i-1] + " ");
        }
    }`

http://www.oschina.net/code/snippet_811799_14119