Lucky PalinProblem code: LUCKPAL |
All submissions for this problem are available.
Chef Palin, as his name suggests, is always very interested in palindromic strings. Recently, he made a pretty interesting discovery on palindromes and that made him feel really Lucky. He came across something known as Lucky Palindromes. He defines a string as being a lucky palindrome if it is a palindrome containing the string "lucky" as a substring. As always, now he wants to turn every string he comes across into a lucky palindrome. Being a chef, he is a man of patience and creativity, so he knows the operation of replacing any character of the string with any other character very well and he can perform this action infinitely many times. He wants you to write a program that can help him convert a given string to a lucky palindrome using the minimum number of operations and if several such lucky palindromes are possible, then output the lexicographically smallest one.Input
The first line contains a single integer T <= 100 the number of testcases. The following T lines each contain a string of length <= 1000 and only containing characters 'a'-'z'.
Output
For each line of testcase, your program should output on a single line, the required lucky palindrome along with the minimum number of operations, both separated by a single space. If there is no lucky palindrome possible, then just output "unlucky" in a single line.
Example:
Input
3
laubcdkey
luckycodechef
aaaaaaaa
Output
luckykcul 8
luckycocykcul 6
unlucky
| Author: | ankul_iiita |
| Date Added: | 27-08-2011 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments

Fetching successful submissions

Mr. admin, the palindrome
^above : "luckycodechef" to
@admin: thanks a lot.
Is it important how many
@aircube, no @problem setter
@pr0ton, thanks.
can i replace character of
it seems that the judge input
judge data contains space
i just wanna say that, C++ /
@admin - Please confirm
Did anyone else think this
@admin Can you please tell
what are the problems with
the smallest lexicographic
@people - Test cases are
I have tried for many test
@efficience the answer may be
@dudechandan123 , thanx a lot
@dedechandan123 , thanx
Can admin provide any complex
what does replacement of
is it mecessary that every
input is correct... use
Limits are too easy. My brute
Admin, moderate comments
I am using "cin" with
can anyone provide some
Can anyone please explain me
nevermind, the
what should be the output for
Okay, No problem with
replacing any character of
@amriteshanand replace with
how is luckycoykcul a
sorry.. My BAD!
can any one provide a complex
what will be the output for
@amriteshanand ykculckclucky
hey sorry ans will be
@admin can u please check my
@amriteshanand I am getting
@allada i am not able to view
@mkagenius: hehe.. during the
@mkagenius: can u provide any
All I can say is, try to
@mkgenius I am also getting
@mkagenius : thanx very much
what should be the output for
@ascend: unlucky
Can someone provide more test
Hi, are there any problems in
I am sorry, cout"str""endl"
Can you please check
Hi, can anyone listdown any
Hiee admin .. Check out my