INPUT = 'FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth'
chars = INPUT.split('')
max = 0
offset = 0
to_push = []

chars.each_with_index do |c, n|
        next if n == 0 or n == chars.length
        count = 0
        i = 0
        loop do
                if chars[n + i] == chars[n - i]
                        count += 1
                        i += 1
                else
                        break
                end
        end
        if count > max
                max = count
                offset = n
        end
        # p "#{c}: #{count} (offset: #{n})"
end

max.times do |i|
        to_push << chars[offset + i]
end

to_push.reverse!
# Slightly incorrect output if double center chars, but love it, it works.
# Lunch break is now over and I'll find a fix to that bug later.
to_push = to_push + to_push[0..(to_push.length / 2)].reverse
p to_push.join