Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Coding Question Problem Statement Given a string S, find the longest palindromic substring in S. Incase there are 2 or more substrings of same length,
Coding Question Problem Statement Given a string S, find the longest palindromic substring in S. Incase there are 2 or more substrings of same length, return the substring which occurs first (with the least starting index) Input: The testcase consists of a String S. Output: Print the longest palindrome of the string given in test case. NOTE: Spaces are not considered. In case no palindromic substring exists. print the 1 st character, since single characters are palindromic in nature Constraints: 1str100 1str100 Example 1: Input: abnamalayalamano Output: namalayalaman Example 2: Input: abmadambc Output: bmadamb The above mentioned example is a sample in the backend. Make sure you click the Previous in the backend. Make sure you click the SUBMIT button to save and submit your answer. 1 ATP 1: start writing your answer from line 8 2 3 import sys \#this lines imports sys library 4 input_from_question=input() \#Gets the Input 5 6 - def solution(input_from_question): 7 \#\# WRITE YOUR ANSWER HERE \#\# 8 \#TIP 2: use input() again to get input in different lines \#TIP 3: use input_from_question.split(' ') to get different values return print(solution(input_from_question)) \#Printing the output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started