My assignment is to write methods for a class where I test for palindromes that a user enters. The class must have a recursive method and that method must call a helper method that removes spaces, punctuation, and ignores case.

I have two working classes that do these things but I'm wondering which structure works better and which helper method actually fits the description of a helper method.

Here's the first class:

```
public class RecursivePalindrome
{

public boolean Palindrome(String s)
{
    return PalindromeHelper(s);
}

public boolean PalindromeHelper(String s)
{
    String a = s.toLowerCase();    //Converts any capital letters to lowercase beforte analyzing the string
    a = a.replaceAll(" ", "");    //Removes any and all spaces in the string

    for(int i = 0; i < a.length(); i++)     //Removes punctuation by using isLetter method from Character Class
    {
        if(Character.isLetter(a.charAt(i)) == false)
            a = a.replace(a.substring(i, i+1), "");
    }

    if(a.length() == 0 || a.length() == 1)
        return true;
    else if(a.charAt(0) == (a.charAt(a.length() - 1)))
        return PalindromeHelper(a.substring(1, a.length() - 1));
    else
        return false;
}
}

```

And the second one:

```
public class Recurs
{

public boolean Palindrome(String s)
{
    String l = PalindromeHelper(s);

    if(l.length() == 0 || l.length() == 1)
        return true;
    else if(l.charAt(0) == (l.charAt(l.length() - 1)))
        return Palindrome(l.substring(1, l.length() - 1));
    else
        return false;
}

public String PalindromeHelper(String s)
{
    s = s.toLowerCase();    //Converts any capital letters to lowercase before analyzing the string
    s = s.replaceAll(" ", "");    //Removes any and all spaces in the string

    for(int i = 0; i < s.length(); i++)     //Removes punctuation by using isLetter method from Character Class
    {
        if(Character.isLetter(s.charAt(i)) == false)
            s = s.replace(s.substring(i, i+1), "");
    }
    return s;
}
}

```