题解 | #字符串反转#

字符串反转

https://www.nowcoder.com/practice/e45e078701ab4e4cb49393ae30f1bb04

import java.io.IOException;
import java.util.Scanner; 
public class Main{
    public static void main(String []args) throws IOException{

        Scanner sc = new Scanner(System.in);
        StringBuffer sb = new StringBuffer();
        while (sc.hasNext()){

            String str = sc.next().toLowerCase();
           if(str.length() <= 1000){
                for (int i = str.length() - 1; i >=0 ; i--) {
                    sb.append(str.charAt(i));
                }
                System.out.println(sb);
            }

        }
        sb.delete(0,sb.length());
    }
}
#华为OD机考#
全部评论

相关推荐

07-28 16:37
门头沟学院 Java
哎,继续加油吧
ResourceUt...:能接到面试就已经是✌🏻了
腾讯一面2191人在聊
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务