Page 1 of 1
10716 - Evil Straw Warts Live
Posted: Mon Oct 11, 2004 5:29 pm
by Victor Barinov
Can anybody explain how to sovle such problems?
Posted: Tue Oct 12, 2004 11:17 am
by cyfra
Hi!
My solution (which got AC

was quite simple :
for each letter find it's first and last occurence in current string.
select letter for which sum of distances from it's first occurence to beginning and from last one to the end is smallest.
"move it" I mean swap it's first occurence to beginning and last to the end.
and "eliminate" them --> now you have the word which is shorter.
you have to repeat until you have <=1 letters left.
(oh you have to look whether this word can be "swapped" into the palindrom first)
Good Luck