def check(l, r, s, len)
  while l >= 0 && r < len
    if s[l-1] == s[r+1]
      $rec << s[l..r]
    else break
    end
    l -= 1; r += 1
  end
  $ret << s[l..r] if r - l >= 2 && !$rec.include?(s[l..r])
  $rec << s[l..r]
end

while l = gets
  s = ''
  l.split('').each{|c| s += c.capitalize if c =~ /[a-zA-Z]/ }
  $ret = []
  len = s.size
  $rec = []
  (1..len-2).each do |c|
    check(c, c, s, len)
    check(c, c + 1, s, len) if s[c] == s[c+1]
  end
  puts $ret.compact.join(' ')
end