On One test case i am getting wrong anwer
can you help me !
Submission #3095771
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Scanner;
public class RecursionChallenge {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
String str= s.nextLine();
ArrayList<String> mylist=RecursionDictionary(str);
//System.out.println(mylist);
for(int i=0;i<mylist.size();i++)
{
String mystring=mylist.get(i);
for(int j=0;j<str.length();j++)
{
if(mystring.charAt(j)<str.charAt(j))
break;
else if(mystring.charAt(j)>str.charAt(j))
{
System.out.println(mystring);
break;
}
else if(mystring.charAt(j)==str.charAt(j))
continue;
}
}
}
public static ArrayList<String> RecursionDictionary(String str)
{
if(str.length()==1)
{
ArrayList<String> list= new ArrayList<String>();
list.add(""+str.charAt(0));
return list;
}
char cc= str.charAt(0);
String RestOfString= str.substring(1);
ArrayList<String> myresult= new ArrayList<String>();
ArrayList<String> RecResult= RecursionDictionary(RestOfString);
for(int i=0;i<RecResult.size();i++)
{
String Recstr=RecResult.get(i);
for(int j=0;j<=Recstr.length();j++)
{
myresult.add(Recstr.substring(0,j)+cc+Recstr.substring(j));
}
}
return myresult;
}
}