题解 | #字符串反转#
字符串反转
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);
int maxLen = 1000;
while(sc.hasNext()){
String line = sc.nextLine().toLowerCase();
if (line.length() > maxLen)
line = line.substring(0, maxLen);
System.out.println(new StringBuilder(line).reverse());
}
}
}
#华为面试##华为笔试#
import java.util.Scanner;
public class Main{
public static void main(String []args) throws IOException{
Scanner sc = new Scanner(System.in);
int maxLen = 1000;
while(sc.hasNext()){
String line = sc.nextLine().toLowerCase();
if (line.length() > maxLen)
line = line.substring(0, maxLen);
System.out.println(new StringBuilder(line).reverse());
}
}
}
#华为面试##华为笔试#