/* ACM ICPC Asia 98 Tokyo Problem D: Napoleon's Grumble by Naoyuki Tamura (tamura@kobe-u.ac.jp) */ import java.io.*; import java.util.*; public class D { static boolean dbg = false; static DataInputStream in = new DataInputStream(System.in); static String str; static Vector palin; static Vector check; static void debug(String msg) { if (dbg) System.err.print(msg); } static boolean read() throws Exception { String line = null; debug("# Enter\n"); line = in.readLine(); if (line == null) return false; line = line.toUpperCase(); str = ""; for (int i = 0; i < line.length(); i++) { char c = line.charAt(i); if ('A' <= c && c <= 'Z') { str = str + c; } } return true; } static boolean palindrome(String s) throws Exception { int i, j; int n = s.length(); for (i = 0, j = n-1; i < j; i++, j--) { if (s.charAt(i) != s.charAt(j)) return false; } return true; } static void addPalin(String s) throws Exception { palin.addElement(s); int i, j; for (i = 0, j = s.length(); i + 3 <= j; i++, j--) { check.addElement(s.substring(i, j)); } } static void solve() throws Exception { palin = new Vector(); check = new Vector(); int len, center, i, j; String s; for (len = str.length(); len >= 3; len--) { for (i = 0; i + len <= str.length(); i++) { s = str.substring(i, i+len); if (palindrome(s)) { if (check.contains(s)) debug("# Old: "+s+"\n"); else { debug("# New: "+s+"\n"); addPalin(s); } } } } } public static void main(String args[]) { if (args.length > 0) dbg = true; try { while (read()) { solve(); String delim = ""; for (int i = 0; i < palin.size(); i++) { String s = (String)palin.elementAt(i); System.out.print(delim + s); delim = " "; } System.out.println(); } } catch (Exception e) { e.printStackTrace(); } } }