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 

 

palindrome.txt

a aa ab madam cbabcde

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

Database Management System MCQs Multiple Choice Questions And Answers

Authors: Arshad Iqbal

1st Edition

1073328554, 978-1073328550

More Books

Students also viewed these Databases questions

Question

Identify how culture affects appropriate leadership behavior

Answered: 1 week ago