palin - There will be fewer than 1000 words in all the...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 Palindrome Sentences ---------- --------- Given a set of words, find the longest possible palin- drome using only that set of words, with no repeated words. A palindrome is a phrase whose alphabetic characters are in the same sequence when reversed, as in Madam, I'm Adam or Able was I ere I saw Elba or A man, a plan, a canal: Panama. (Note that two of these have repeated words this is disallowed by our problem specification.) The length is measured in characters NOT including spaces. The input sets will have no repeated words. The input will consist of multiple sets of words. Each word is on a single line by itself, and each set of words ends with an empty line that contains nothing. There are no space characters in any line. Each word consists solely of lowercase letters.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: There will be fewer than 1000 words in all the input word sets combined and no word will be longer than 80 characters. c Output is a single line containing the unique longest palindrome made from each word set. The input word sets will be chosen so that there is exactly one longest palindrome that can be made from the word set without repeating words. There must be a single space character between consecutive words in the output line, and no other space characters in the line. The line may be very long. The words and the palindromes may not necessarily make sense. Sample input: an Sheet1 Page 2 bann nab foo code coder contest fast gnu problem redo reverse rung Sample output: bann an nab gnu redo code rung...
View Full Document

This note was uploaded on 04/29/2011 for the course IT 201 taught by Professor K.v.arya during the Spring '11 term at IIT Kanpur.

Page1 / 2

palin - There will be fewer than 1000 words in all the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online