Question: Need help with this. It need to use Java and no loop. The below is the template: import java.text.Normalizer; import java.text.Normalizer.Form; import java.util.ArrayList; import java.util.Collections;

Need help with this. It need to use Java and no loop.

Need help with this. It need to use Java and no loop.The below is the template: import java.text.Normalizer; import java.text.Normalizer.Form; import java.util.ArrayList; importThe below is the template:

import java.text.Normalizer; import java.text.Normalizer.Form; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.regex.Pattern; import java.util.regex.Matcher; import java.util.regex.MatchResult; import java.util.stream.Stream; import java.util.stream.Collectors; public class Palindrome { static boolean isSimplePalindrome(String s) { // insert code here! } static String simplifyString(String s) { // insert code here! } static boolean isPalindrome(String s) { String simplified = simplifyString(s); return isSimplePalindrome(simplified); } public static void main(String[] args) { System.out.println("running testSimplify"); testSimplifyString(); System.out.println("running testIsPalindrome"); testIsPalindrome(); } static final String facePalm = "\uD83E\uDD26"; // surrogate pair for 1F926 static final String fitzpatrick_3 = "\uD83C\uDFFC"; // surrogate pair for 1F3FC static final String facePalm_3 = facePalm + fitzpatrick_3; // See https://emojipedia.org/person-facepalming-medium-light-skin-tone/ static final String zeroWidthJoiner = "\u200D"; static final String maleSign = "\u2642"; static final String variationSelector = "\uFE0F"; static final String maleFacePalm = facePalm + zeroWidthJoiner + maleSign + variationSelector; // See https://emojipedia.org/man-facepalming/ static final String maleFacePalm_3 = facePalm_3 + zeroWidthJoiner + maleSign + variationSelector; // See https://emojipedia.org/man-facepalming-medium-light-skin-tone/ public static void testSimplifyString() { System.out.println(simplifyString("Madam I'm Adam").equals("MADAMIMADAM") == true); System.out.println(simplifyString("As Mario oir misa").equals("ASIMARIOOIRAMISA") == true); System.out.println(simplifyString("[]").equals("[]") == true); } public static void testIsPalindrome() { System.out.println(isPalindrome("tacocat") == true); System.out.println(isPalindrome("hello") == false); System.out.println(isPalindrome("Racecar") == true); System.out.println(isPalindrome("Madam I'm Adam") == true); System.out.println(isPalindrome("As Mario oir misa")== true); System.out.println(isPalindrome(" ,   ") == true); System.out.println(isPalindrome(Palindrome.facePalm) == true); System.out.println(isPalindrome(Palindrome.facePalm_3) == true); System.out.println(isPalindrome(Palindrome.facePalm + Palindrome.facePalm_3) == false); System.out.println(isPalindrome(Palindrome.maleFacePalm) == true); System.out.println(isPalindrome(Palindrome.maleFacePalm_3) == true); } }

A High-Level Statement of Algorithm for Palindrome Detection Given a string, and without writing any loops (note that this description is programming language neutral): Algorithm for Non-trivial Palindrome Detection 1. Simplify the input string: A. Obtain a "normalized" copy of the string that both decomposes composed code points, and performs a compatibility mapping that replaces "fancy" versions of code points with more "basic" versions. B. Obtain an copy of the string with uniform upper case rather than mixed case. C. Iterate over the code points of the string, removing code points corresponding to the following, to form a sequence of code points separators such as spaces, tabs, newlines, and carriage returns punctuation combining marks D. Convert the code point sequence into a string and return the string 2. Test the resulting string to see if it is a simple palindrome. 1 A High-Level Statement of Algorithm for Palindrome Detection Given a string, and without writing any loops (note that this description is programming language neutral): Algorithm for Non-trivial Palindrome Detection 1. Simplify the input string: A. Obtain a "normalized" copy of the string that both decomposes composed code points, and performs a compatibility mapping that replaces "fancy" versions of code points with more "basic" versions. B. Obtain an copy of the string with uniform upper case rather than mixed case. C. Iterate over the code points of the string, removing code points corresponding to the following, to form a sequence of code points separators such as spaces, tabs, newlines, and carriage returns punctuation combining marks D. Convert the code point sequence into a string and return the string 2. Test the resulting string to see if it is a simple palindrome. 1

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!