首页 > 其他 > 详细

1062 Text Reverse

时间:2019-07-08 13:45:25      阅读:91      评论:0      收藏:0      [点我收藏+]

技术分享图片

import java.util.Scanner;
 
public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        sc.nextLine();
 
        while (t-- > 0)
        {
            String str = sc.nextLine();
            String []strs = str.split(" ");
            String output = "";
            for (int i = 0; i < strs.length; i++)
            {
                for (int j = strs[i].length() - 1; j >= 0; j--)
                    output += strs[i].charAt(j);
                if ((i + 1) == strs.length)
                    continue;
                output += " ";
            }
 
            if (str.endsWith(" "))
                output += " ";
 
            System.out.println(output);
        }
    }
}

1062 Text Reverse

原文:https://www.cnblogs.com/cznczai/p/11150295.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!