Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment is in python. Only answer if you are familiar with it. Any help is appreciated A string is palindromic if it reads the

This assignment is in python. Only answer if you are familiar with it. Any help is appreciated

A string is palindromic if it reads the same forwards and backwards. For example, radar and racecar are palindromes. In this programming exercise you will read in a string and return the smallest string that is palindromic by adding letters to the beginning of the string.

Input: You will read the data from a file called palindrome.txt. This file will have one string per line. Each string will have 1 to 100 lower case characters from a to z. There will be no digits, punctuation marks, or spaces in those strings.

Output: Your output will be the shortest palindrome that you can make by adding letters to the beginning of the string. There will be one palindrome per line in your output.

Sample Input:

a aa ab madam cbabcde

Sample Output:

a aa bab madam edcbabcde

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Privacy In Statistical Databases International Conference Psd 2022 Paris France September 21 23 2022 Proceedings Lncs 13463

Authors: Josep Domingo-Ferrer ,Maryline Laurent

1st Edition

3031139445, 978-3031139444

More Books

Students also viewed these Databases questions