TOPIC

Erro de apresentação

Marcus Vinícius Neves Voltolim Satelis asked 1 year ago

import java.io.IOException;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws IOException {
       final Scanner read = new Scanner(System.in);

        for (int n = read.nextInt(); n >= 0; n--) {
            StringBuilder in = new StringBuilder(read.nextLine());

            for (int i = 0; i < in.length(); i++) {
                char c = in.charAt(i);
                if (Character.isAlphabetic(c)) {
                    in = in.replace(i, i + 1, String.valueOf((char) (c + 3)));
                }
            }
            in = in.reverse();
            for (int i = (in.length() / 2); i < in.length(); i++) {
                char c = in.charAt(i);
                    in = in.replace(i, i + 1, String.valueOf((char) (c - 1)));
            }
            System.out.println(in);
        }
    }

}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.