My 2nd testcase is not passing.I have tried HARD.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
String str=scn.nextLine();
scn.close();
int i=0;
int e=str.length()-1;
System.out.println(Removedup(str,i,e));
}
private static String Removedup(String str,int i,int e) {
if(i>=e) {
return str;
}
if(str.charAt(i)==str.charAt(i+1)) {
str=str.substring(0,i+1)+'*'+str.substring(i+1);
}
return Removedup(str,i+1,e);
}
}