Least Palindromes
Enter a string ===>> Raceca
String:Raceca
Palindrome: false
Almost Palindrome: false
Least Palindrome:RacecacecaR
It's supposed to go :
Enter a string ===>> Raceca
String:Raceca
Palindrome: false
Almost Palindrome: false
Least Palindrome:RacecaR
I need to use the least amount of letters
private String leastPal()
{
String temp="";
if(isPal(s1)==true)
{
return s1;
}
else
{
String e="";
String f="";
int j=s1.length();
for(int k=0; k<j; k++)
e=s1.substring(0,k);
int h=e.length();
for(int m=h-1;m>=0; m--)
{
f+=s1.charAt(m);
temp=s1+f;
if(isPal(temp))
{
return temp;
}
}}
return temp;
}
How could I change it so that it stops at the first letter, checks, and then goes throught the loop again? Thanks for your help :)

