NXS1- Editorial



Author: Setter’s name
Tester: Tester’s name
Editorialist: Editorialist’s name


cakewalk .


Given T test case. For each test case, you are given a String S so you need to convert that given String into secure String by Encryption. There is a way to encrypt the message by shifting the alphabets by 3 alphabets in a circular manner of String S. Where S contains capital alphabets.


So after reading this problem, some people will think that what if we just add 3 into ASCII value so what will be the character for x,y,z let me clear that its mention above that you can shift the alphabets by 3 in Circular manner.

There is a simple approach used by me that we can get ASCII of each character. Hence it contains a capital letter we subtract 65. So the character is between(0-25). Suppose the character is x so calculate x=(x+3) % 26 is a new character we need to place, hence it is between 0-25 we add 65 to get a character in the upper letter. And there is one important condition don't forget to skip ' ' (space) character.


Setter's Solution
import java.io.*;
class NXS {
	public static void main (String[] args)throws IOException {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    int test = Integer.parseInt(br.readLine());
	        String s= br.readLine();
	        int n=s.length();
	        String ans="";
	        for(int i =0 ; i<n ;i++){
	            if(s.charAt(i)==' '){
	                ans+=' ';
	            int x = s.charAt(i)-65;

Feel free to Share your approach, if you want to. (even if its same) . Suggestions are welcomed as always had been.