Problem link-https://www.codechef.com/problems/ALPHA
I used this Approach.
My Solution-https://www.codechef.com/viewsolution/11541325
…
class alpha
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t!=0)
{
String alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
String p=sc.next();
StringBuilder sb=new StringBuilder();
char ch;
int ind=0;
boolean flag=false;
for(int i=0;i<p.length();i++)
{
flag=false;
ch=p.charAt(i);
ind=alpha.indexOf(ch);
if(ind!=-1)
{
if(ind==25)
{
ind=0;
flag=true;
}
if(ind==51)
{
ind=26;
flag=true;
}
if(flag!=true)
ch=alpha.charAt(ind+1);
else
ch=alpha.charAt(ind);
sb.append(ch);
}
}
System.out.println(sb);
t--;
}
}
}