Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) throws IOException {
- Scanner leitor = new Scanner(System.in);
- int N = leitor.nextInt();
- for (int i = 0; i < N; i++) {
- String frase = readLine(leitor);
- StringBuilder parte1 = new StringBuilder(frase.substring(0, frase.length() / 2));
- StringBuilder parte2 = new StringBuilder(frase.substring(frase.length() / 2, frase.length()));
- parte1.reverse();
- parte2.reverse();
- System.out.println(parte1.toString() + parte2.toString());
- }
- }
- public static String readLine(Scanner leitor) {
- String line = leitor.nextLine();
- while (line.isEmpty())
- line = leitor.nextLine();
- return line;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement