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

public class ragnarok_dk {

final int MOD = 1000000007;
	long[] h, r, p;
	int n;

	boolean compare(int l1, int r1, int l2, int r2) {
		long h1 = h[r2];
		if (l2 > 0)
			h1 = (h1 + MOD - h[l2 - 1]) % MOD;
		int l3 = n - 1 - r1;
		int r3 = n - 1 - l1;
		long h2 = r[r3];
		if (l3 > 0)
			h2 = (h2 + MOD - r[l3 - 1]) % MOD;
		return ((l2 < l3 && (h1 * p[l3 - l2]) % MOD == h2) || (l2 > l3	&& h1 == (h2 * p[l2 - l3]) % MOD) || (l2 == l3 && h1 == h2));
	}

	void solve() throws IOException {
		String s = nextToken();
		n = s.length();
		if (n == 1) {
			out.println(s);
			return;
		}
		p = new long[n];
		p[0] = 1;
		for (int i = 1; i < n; i++) {
			p[i] = p[i - 1] * 239 % MOD;
		}

		h = new long[n];
		for (int i = 0; i < n; i++) {
			h[i] = (s.charAt(i) - 'a' + 1) * p[i];
			if (i > 0)
				h[i] += h[i - 1];
		}

		StringBuilder sb = new StringBuilder(s);
		String st = new String(sb.reverse());

		r = new long[n];
		for (int i = 0; i < n; i++) {
			r[i] = (st.charAt(i) - 'a' + 1) * p[i];
			if (i > 0)
				r[i] += r[i - 1];
		}

		int min = n - 1;
		int mid = 0;
		boolean f = true;
		for (int i = 0; i < n; i++) {
			int len = Math.min(i, n - i);
			if (len != 0)
				if (compare(i - len, i - 1, i, i + len - 1)) {
					int ans = n - 2 * len;
					if (ans < min) {
						min = ans;
						mid = i;
						f = false;
					}
				}

			len = Math.min(i, n - i - 1);
			if (len != 0)
				if (compare(i - len, i - 1, i + 1, i + len)) {
					int ans = n - 2 * len - 1;
					if (ans < min) {
						min = ans;
						mid = i;
						f = true;
					}
				}
		}
		String string = new String();
		if (mid < n / 2 && f) {
				string = s.substring(mid + 1);
				StringBuilder sb1 = new StringBuilder(string);
				StringBuilder sb2 = new StringBuilder(string);
				sb2.reverse();
				sb2.append(s.charAt(mid));
				sb2.append(sb1);
				string = new String(sb2);
			}
		if (mid <= n / 2 && !f) {
				string = s.substring(mid);
				StringBuilder sb1 = new StringBuilder(string);
				StringBuilder sb2 = new StringBuilder(string);
				sb2.reverse();
				sb2.append(sb1);
				string = new String(sb2);
		}
		if (mid >= n / 2 && f) {
				string = s.substring(0, mid);
				StringBuilder sb1 = new StringBuilder(string);
				StringBuilder sb2 = new StringBuilder(string);
				sb2.reverse();
				sb1.append(s.charAt(mid));
				sb1.append(sb2);
				string = new String(sb1);
		}
		if (mid > n / 2 && !f) {
				string = s.substring(0, mid);
				StringBuilder sb1 = new StringBuilder(string);
				StringBuilder sb2 = new StringBuilder(string);
				sb2.reverse();
				sb1.append(sb2);
				string = new String(sb1);
			}
		out.println(string);
		//out.println(min + " " + mid + " " + f);
	}
	void run() throws IOException {
		br = new BufferedReader(new FileReader("ragnarok.in"));
		out = new PrintWriter("ragnarok.out");
		solve();
		br.close();
		out.close();
	}

	BufferedReader br;
	PrintWriter out;
	StringTokenizer stok;

	String nextToken() throws IOException {
		while (stok == null || !stok.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null) {
				return null;
			}
			stok = new StringTokenizer(s);
		}
		return stok.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	char nextChar() throws IOException {
		return (char) (br.read());
	}

	String nextLine() throws IOException {
		return br.readLine();
	}

	public static void main(String[] args) throws IOException {
		Locale.setDefault(Locale.US);
		new ragnarok_dk().run();
	}
}