WORKSHEET-3.1 Java PDF New
WORKSHEET-3.1 Java PDF New
Experiment- 3.1
1. Aim : Create a palindrome creator application for making a longest possible palindrome out
of given input string.
2. Objective : Given a string, S, find its largest palindromic substring. Input Format: A string,
S. Constraints: 151000000. All the characters are lower-case English letters. Output Format:
Print the largest possible substring of S.
3. Procedure :
1. First, we need to consider the type of value.
2. If it is a number, we need to change it to a string to compare how it reads backwards and forwards.
3. If it is an object, we need to somehow also change it to a string to do a comparison.
4. If it is a string, we can forge ahead.
5. Compare a string with its reversed version.
6. Iterate using for loop and check to see if character on other side of string.
7. Use recursion to check the rst and last letters before invoking the function again with the shortened
string.
Program Code :
import java.util.Scanner;
Output :
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
4. Learning Outcomes :