public P335B() {
        Scanner sc = new Scanner(System.in);
        s = sc.next();
        final int N = s.length();
        markPrev = new int[101];
        markCurr = new int[101];
        for (int i = 0; i < 101; i++) {
            markPrev[i] = markCurr[i] = -1;
        }
        
        next = new ArrayList<ArrayList<Link>>();
        for (int i = 0; i < 101; i++) {
            next.add(new ArrayList<Link>());
        }
        
        for (int i = 0; i < 26; i++) {
            letterPos.add(new TreeSet<Integer>());
        }
        
        for (int i = 0; i < N; i++) {
            process(i);
            if (markPrev[100] >= 0) {
                break;
            }
        }
        
        int length = 0;
        for (int i = 100; i >= 1; i--) {
            if (markPrev[i] >= 0) {
                length = i;
                break;
            }
        }
        
        Link link = getTail(length);
        char[] result = new char[length];
        int len = length;
        int pos = link.pos;
        result[0] = result[length-1] = s.charAt(pos);
        for (int i = 1; i < (length+1)/2; i++) {
            len -= 2;
            link = getLink(len, link.index);
            pos = link.pos;
            result[i] = result[length-i-1] = s.charAt(pos);
        }
        
        for (int i = 0; i < length; i++) {
            System.out.printf("%c", result[i]);
        }
        System.out.println();
    }