package adc;
import java.util.*;
public class bca {
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the sentence to decrypt");
String s=sc.nextLine();
char[] ans = s.toCharArray();
int len=s.length();
char[] sol= new char[len];
System.out.println("len="+s.length());
for(int i=0;i<len;i++) {
int j=i;
if(ans[i]=='1') {
sol[i]=ans[i-1];
}
else if(ans[i]=='2') {
sol[i]=ans[i-1];
sol[i+1]=ans[i-1];
}
else {
sol[i]=ans[i];
}
System.out.print(sol[i]);
}
sc.close();
}
}
new here learning java tring to get some help here thank you.
Enter the sentence to decrypt Input:o1ps o2ps output:len=9 oops oopsis it possible to make o2ps has ooops