//package pkg1297palindrome;

import java.io.*;
import java.util.*;

public class Main {
    
    InputReader in;
    PrintWriter out;
    
    public static void main(String[] args) {
        new Main().Run();
    }
    
    void Solve() throws Exception{
        String s;
        s = in.readLine();
        int n = s.length();
        char[] ss = s.toCharArray();
        s = "";
        for(int i = 0; i < n; i++) s = s + ss[i] + "0";
        int m = s.length();
        char[] s2 = s.toCharArray();
        int max = 1, M = 1;
        for(int i = 1; i < m - 1; i++){
            int L = i, R = i;
            while(s2[L] == s2[R]){
                L--; R++;
                if(L < 0 || R >= m) {
                    L++; R--; break;
                }
            }
            if(max < R - L + 1){
                max = R - L + 1;
                M = i;
            }
        }
        s = "";
        int L = M, R = M;
        while(s2[L] == s2[R]){
            if(s2[L] != '0') {
                if(L != R) s = s2[L] + s + s2[R];
                else s = s + s2[L];
            }
            L--; R++;
            if(L < 0 || R >= m) break;
        }
        out.println(s);
    }
    
    public void Run(){
        try{
            File defaultInput = new File("text.inp");
            if(defaultInput.exists()) in = new InputReader("text.inp");
            else in = new InputReader();
            out = new PrintWriter(System.out);
            Solve();
            out.close();
        } catch (Exception e){
            e.printStackTrace();
            System.exit(261);
        }
    }
    
    class InputReader {
        BufferedReader reader;
	StringTokenizer tokenizer;
		
	InputReader() {
            reader = new BufferedReader(new InputStreamReader(System.in));
        }
		
	InputReader(String fileName) throws FileNotFoundException {
            reader = new BufferedReader(new FileReader(new File(fileName)));
	}
		
	String readLine() throws IOException {
            return reader.readLine();
	}
		
        String nextToken() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(readLine());
            return tokenizer.nextToken();
	}
		
	boolean hasMoreTokens() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                String s = readLine();
                if (s == null) return false;
		tokenizer = new StringTokenizer(s);
            }
            return true;
	}
		
	int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(nextToken());
	}
		
	long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(nextToken());
	}
		
        double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(nextToken());
	}
    }
    
}
