Question: Write a program (using recursion), on the template provided below, that will check if a given string is a palindrome ignoring spaces, punctuation marks, and

Write a program (using recursion), on the template provided below, that will check if a given string is a palindrome ignoring spaces, punctuation marks, and all characters different than lowercase letters in the string.

import java.util.Scanner;

public class PalindromeRecursive {

public static void main(String[] args) {

System.out.print("Enter a string to check if it is palindrome :: ");

Scanner input = new Scanner(System.in);

String inputString = input.nextLine();

String palindromeString = cleanupString(inputString);

boolean isPalindrome = checkPalindrome(palindromeString, 0, palindromeString.length()-1);

if (isPalindrome) {

System.out.println("The given string is a palindrome");

} else {

System.out.println("The given string is not a palindrome");

}

input.close();

}

/* Creating a method for performing string clean operation to get rid of unwanted characters */

private static String cleanupString(String s) {

String cleanupStr = "";

/* * Write a logic that should include only lower case alphabets. * It should not include special characters, numbers and spaces. */

return cleanupStr;

}

private static boolean checkPalindrome(String inputString, int low, int high) {

// Write a logic that should call checkPalindrome(String inputString, int low, int high) method recursively.

return false;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!