#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
    const int mod = 2600000069;
    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
    const int mod = 2600000069;
    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

const int MAXN = 2601;

int dp[MAXN][MAXN];
pii par[MAXN][MAXN];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    string s;
    cin >> s;
    int n = s.size();
    if (n >= 2600) {
        vector<int> cnt(26, 0);
        for (int i = 0; i < n; i++) cnt[s[i] - 'a']++;
        for (int i = 0; i < 26; i++) {
            if (cnt[i] >= 100) {
                for (int j = 0; j < 100; j++) cout << char('a' + i);
                return 0;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        dp[i][i] = 1;
        par[i][i] = {-1, -1};
        if (s[i] == s[i + 1]) {
            dp[i][i + 1] = 2;
            par[i][i + 1] = {i, i + 1};
        } else {
            dp[i][i + 1] = dp[i][i];
            par[i][i + 1] = par[i][i];
        }
    }
    for (int l = 3; l <= n; l++) {
        for (int i = 0; i < n - l + 1; i++) {
            if (s[i] == s[i + l - 1]) {
                dp[i][i + l - 1] = dp[i + 1][i + l - 2] + 2;
                par[i][i + l - 1] = {i, i + l - 1};
            } else {
                if (dp[i][i + l - 2] >= dp[i + 1][i + l - 1]) {
                    dp[i][i + l - 1] = dp[i][i + l - 2];
                    par[i][i + l - 1] = par[i][i + l - 2];
                } else {
                    dp[i][i + l - 1] = dp[i + 1][i + l - 1];
                    par[i][i + l - 1] = par[i + 1][i + l - 1];
                }
            }
        }
    }
    string ans;
    int l = par[0][n - 1].first, r = par[0][n - 1].second;
    while (1) {
        if (ans.size() == 50 || par[l][r].first == -1 || l > r || l == -1 || r == -1 || l == r) break;
        ans = ans + s[l];
        int nl = par[l + 1][r - 1].first, nr = par[l + 1][r - 1].second;
        if (nl == -1) {
            l++;
            break;
        }
        l = nl;
        r = nr;
    }
    if (ans.size() == 50 || l > r) {
        cout << ans;
        reverse(all(ans));
        cout << ans;
    } else {
        cout << ans;
        reverse(all(ans));
        cout << s[l];
        cout << ans;
    }
}
/*

*/


#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
    const int mod = 2600000069;
    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
    const int mod = 2600000069;
    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

const int MAXN = 2601;

int dp[MAXN][MAXN];
pii par[MAXN][MAXN];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    string s;
    cin >> s;
    int n = s.size();
    if (n >= 2600) {
        vector<int> cnt(26, 0);
        for (int i = 0; i < n; i++) cnt[s[i] - 'a']++;
        for (int i = 0; i < 26; i++) {
            if (cnt[i] >= 100) {
                for (int j = 0; j < 100; j++) cout << char('a' + i);
                return 0;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        dp[i][i] = 1;
        par[i][i] = {-1, -1};
        if (s[i] == s[i + 1]) {
            dp[i][i + 1] = 2;
            par[i][i + 1] = {i, i + 1};
        } else {
            dp[i][i + 1] = dp[i][i];
            par[i][i + 1] = par[i][i];
        }
    }
    for (int l = 3; l <= n; l++) {
        for (int i = 0; i < n - l + 1; i++) {
            if (s[i] == s[i + l - 1]) {
                dp[i][i + l - 1] = dp[i + 1][i + l - 2] + 2;
                par[i][i + l - 1] = {i, i + l - 1};
            } else {
                if (dp[i][i + l - 2] >= dp[i + 1][i + l - 1]) {
                    dp[i][i + l - 1] = dp[i][i + l - 2];
                    par[i][i + l - 1] = par[i][i + l - 2];
                } else {
                    dp[i][i + l - 1] = dp[i + 1][i + l - 1];
                    par[i][i + l - 1] = par[i + 1][i + l - 1];
                }
            }
        }
    }
    string ans;
    int l = par[0][n - 1].first, r = par[0][n - 1].second;
    while (1) {
//        cout << l << " " << r << "\n";
        if (ans.size() == 50 || par[l][r].first == -1 || l > r || l == -1 || r == -1 || l == r) break;
        ans = ans + s[l];
        if (l + 1 == r) {
            l++;
            r--;
            break;
        }
        int nl = par[l + 1][r - 1].first, nr = par[l + 1][r - 1].second;
        if (nl == -1) {
            l++;
            r--;
            break;
        }
        l = nl;
        r = nr;
    }
//    cout << l << " " << r << "\n";
    if (ans.size() == 50 || l > r) {
        cout << ans;
        reverse(all(ans));
        cout << ans;
    } else {
        cout << ans;
        reverse(all(ans));
        cout << s[l];
        cout << ans;
    }
}
/*

*/


#include<bits/stdc++.h>
using namespace std;
const int nmax=2600+42;
string inp;
int seen[26];
int dp[nmax][nmax];
string build(int l,int r)
{
    //cout<<l<<" "<<r<<endl;
    if(l>r)return "";
    if(l==r)
    {
        string q="";
        q=q+inp[l];
        return q;
    }
    if(dp[l][r]==dp[l+1][r])return build(l+1,r);
    if(dp[l][r]==dp[l][r-1])return build(l,r-1);
    return inp[l]+build(l+1,r-1)+inp[r];
}
int main()
{
cin>>inp;
for(auto k:inp)
    seen[k-'a']++;
for(int i=0;i<26;i++)
    if(seen[i]>=100)
    {
        for(int j=0;j<100;j++)
            cout<<char(i+'a');
        cout<<endl;
        return 0;
    }
int n=inp.size();
for(int i=0;i<n;i++)
    dp[i][i]=1;
for(int d=2;d<=n;d++)
    for(int i=0;i+d-1<n;i++)
    {
        int j=i+d-1;
        dp[i][j]=max(dp[i+1][j],dp[i][j-1]);
        if(inp[i]==inp[j])dp[i][j]=max(dp[i][j],dp[i+1][j-1]+2);
    }
//cout<<dp[0][n-1]<<endl;
int l=1,r=n;
string answer=build(0,inp.size()-1);
if(answer.size()<=100)
{
    cout<<answer<<endl;
    return 0;
}
string s="";
for(int i=0;i<50;i++)
    s=s+answer[i];
for(int j=answer.size()-50;j<answer.size();j++)
    s=s+answer[j];
cout<<s<<endl;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int nmax=2600+42;
string inp;
int seen[26];
int dp[nmax][nmax];
string build(int l,int r)
{
    //cout<<l<<" "<<r<<endl;
    if(l>r)return "";
    if(l==r)
    {
        string q="";
        q=q+inp[l];
        return q;
    }
    if(dp[l][r]==dp[l+1][r])return build(l+1,r);
    if(dp[l][r]==dp[l][r-1])return build(l,r-1);
    return inp[l]+build(l+1,r-1)+inp[r];
}
int main()
{
cin>>inp;
for(auto k:inp)
    seen[k-'a']++;
for(int i=0;i<26;i++)
    if(seen[i]>=100)
    {
        for(int j=0;j<100;j++)
            cout<<char(j+'a');
        cout<<endl;
        return 0;
    }
int n=inp.size();
for(int i=0;i<n;i++)
    dp[i][i]=1;
for(int d=2;d<=n;d++)
    for(int i=0;i+d-1<n;i++)
    {
        int j=i+d-1;
        dp[i][j]=max(dp[i+1][j],dp[i][j-1]);
        if(inp[i]==inp[j])dp[i][j]=max(dp[i][j],dp[i+1][j-1]+2);
    }
//cout<<dp[0][n-1]<<endl;
int l=1,r=n;
string answer=build(0,inp.size()-1);
if(answer.size()<=100)
{
    cout<<answer<<endl;
    return 0;
}
string s="";
for(int i=0;i<50;i++)
    s=s+answer[i];
for(int j=answer.size()-50;j<answer.size();j++)
    s=s+answer[j];
cout<<s<<endl;
return 0;
}


#include<stdio.h>
#include<iostream>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<string>
#include<stack>
#include<queue>
using namespace std;
#define MAXN 2606
char str[50006];
void tada()
{
    int i,freq[27]={0},ch;
    for (i=0; str[i]; ++i)
    {
        ch = str[i]-'a';
        ++freq[ch];
        if (freq[ch]>=100)
        {
            for (i=0; i<100; ++i) printf("%c", ch+'a');
            puts("");
            return;
        }
    }
}
int dp[MAXN][MAXN];
stack <char> S;
struct node
{
    int left, right;
    char *s;
    bool take;
    node() {s = NULL;}
} path[MAXN][MAXN];
char temp[MAXN];
int rec(int left, int right)
{
    if (left>right) return 0;
    if (dp[left][right] != -1) return dp[left][right];
    if (path[left][right].s != NULL) free(path[left][right].s);
    if (left==right)
    {
        path[left][right].take = true;
        temp[0] = str[left];
        temp[1] = 0;
        path[left][right].s = new char[2];
        strcpy(path[left][right].s,temp);
        path[left][right].left = path[left][right].right = -1;
        return dp[left][right] = 1;
    }
    if (left+1 == right)
    {
        if (str[left] == str[right])
        {
            path[left][right].take = true;
            temp[0] = str[left];
            temp[1] = 0;
            path[left][right].s = new char[2];
            strcpy(path[left][right].s,temp);
            path[left][right].left = path[left][right].right = -1;
            return dp[left][right] = 2;
        }
        else
        {
            path[left][right].take = true;
            temp[0] = (str[left]<str[right] ? str[left]:str[right]);
            temp[1] = 0;
            path[left][right].s = new char[2];
            strcpy(path[left][right].s,temp);
            path[left][right].left = path[left][right].right = -1;
            return dp[left][right] = 1;
        }
    }
    if (str[left] == str[right])
    {
        path[left][right].take = true;
        dp[left][right] = rec(left+1, right-1) + 2;
        temp[0] = str[left];
        temp[1] = 0;
        //strcat(temp, path[left+1][right-1].s);
        path[left][right].s = new char[dp[left][right]+2];
        strcpy(path[left][right].s,temp);
        path[left][right].left = left+1;
        path[left][right].right = right-1;
        return dp[left][right];
    }
    else
    {
        path[left][right].take = false;
        int l1 = rec(left, right-1);
        int l2 = rec(left+1, right);
        if (l1>l2 || (l1==l2 && strcmp(path[left][right-1].s, path[left+1][right].s)<0))
        {
            strcpy(temp,path[left][right-1].s);
            path[left][right].s = new char[l1+1];
            strcpy(path[left][right].s, temp);
            path[left][right].left = left;
            path[left][right].right = right-1;
            dp[left][right] = l1;
        }
        else
        {
            strcpy(temp,path[left+1][right].s);
            path[left][right].s = new char[l2+1];
            strcpy(path[left][right].s, temp);
            path[left][right].left = left+1;
            path[left][right].right = right;
            dp[left][right] = l2;
        }
    }
    return dp[left][right];
}
void print_path(int left, int right, int len)
{
    bool f = true;
    if (left>right || len<=0) return;
    if (path[left][right].take)
    {
        printf("%c",path[left][right].s[0]);
        if (len == 1) ++len;
        else
        {
            S.push(path[left][right].s[0]);
            f = false;
        }
        len -= 2;
    }
    if (path[left][right].left == -1 || path[left][right].right == -1) return;
    print_path(path[left][right].left, path[left][right].right, len);
}
int main()
{
    //freopen("data.txt", "r", stdin);
    int len,slen,cnt;
    while(scanf("%s", str) != EOF)
    {
        len = strlen(str);
        if (len > 2574) tada();
        else
        {
            memset(dp, -1, sizeof(dp));
            while(!S.empty()) S.pop();
            slen = strlen(str)-1;
            len = rec(0, slen);
            if (len>100) len=100;
            print_path(0,slen,len);
            cnt = 0;
            while(!S.empty())
            {
                printf("%c", S.top());
                S.pop();
                ++cnt;
                if (cnt == 50) break;
            }
            while(S.size() > 50) S.pop();
            while(!S.empty())
            {
                printf("%c", S.top());
                S.pop();
                ++cnt;
            }
            puts("");
        }
    }
    return 0;
}


#include<stdio.h>
#include<iostream>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<string>
#include<stack>
#include<queue>
using namespace std;
#define MAXN 2606
char str[50006];
void tada()
{
    int i,freq[27]={0},ch;
    for (i=0; str[i]; ++i)
    {
        ch = str[i]-'a';
        ++freq[ch];
        if (freq[ch]>=100)
        {
            for (i=0; i<100; ++i) printf("%c", ch+'a');
            puts("");
            return;
        }
    }
}
int dp[MAXN][MAXN];
stack <char> S;
struct node
{
    int left, right;
    char s;
    bool take;
    node() {s = NULL;}
} path[MAXN][MAXN];
int rec(int left, int right)
{
    if (left>right) return 0;
    if (dp[left][right] != -1) return dp[left][right];
    char temp;
    if (left==right)
    {
        path[left][right].take = true;
        path[left][right].s = str[left];
        path[left][right].left = path[left][right].right = -1;
        return dp[left][right] = 1;
    }
    if (str[left] == str[right])
    {
        path[left][right].take = true;
        dp[left][right] = rec(left+1, right-1) + 2;
        temp = str[left];
        path[left][right].s = temp;
        path[left][right].left = left+1;
        path[left][right].right = right-1;
        return dp[left][right];
    }
    else
    {
        path[left][right].take = false;
        int l1 = rec(left, right-1);
        int l2 = rec(left+1, right);
        if (l1>l2 || (l1==l2 && path[left][right-1].s < path[left+1][right].s))
        {
            temp = path[left][right-1].s;
            path[left][right].s = temp;
            path[left][right].left = left;
            path[left][right].right = right-1;
            dp[left][right] = l1;
        }
        else
        {
            temp = path[left+1][right].s;
            path[left][right].s = temp;
            path[left][right].left = left+1;
            path[left][right].right = right;
            dp[left][right] = l2;
        }
    }
    return dp[left][right];
}
void print_path(int left, int right, int len)
{
    bool f = true;
    if (left>right || len<=0) return;
    if (path[left][right].take)
    {
        printf("%c",path[left][right].s);
        if (len == 1) ++len;
        else
        {
            S.push(path[left][right].s);
            f = false;
        }
        len -= 2;
    }
    if (path[left][right].left == -1 || path[left][right].right == -1) return;
    print_path(path[left][right].left, path[left][right].right, len);
}
int main()
{
    //freopen("data.txt", "r", stdin);
    int len,slen,cnt;
    while(scanf("%s", str) != EOF)
    {
        len = strlen(str);
        if (len > 2574) tada();
        else
        {
            memset(dp, -1, sizeof(dp));
            while(!S.empty()) S.pop();
            slen = strlen(str)-1;
            len = rec(0, slen);
            //printf("\t\t%d\n", len);
            if (len>100) len=100;
            print_path(0,slen,len);
            cnt = 0;
            while(!S.empty())
            {
                printf("%c", S.top());
                S.pop();
                ++cnt;
                if (cnt == 50) break;
            }
            while(S.size() > 50) S.pop();
            while(!S.empty())
            {
                printf("%c", S.top());
                S.pop();
                ++cnt;
            }
            puts("");
        }
    }
    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#define _SECURE_SCL 0
#pragma comment(linker, "/STACK:200000000")

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <fstream>
#include <iostream>
#include <map>
#include <memory.h>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <list>
#include <string>
#include <iomanip>
#include <sstream>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;

#define pb push_back
#define mp make_pair
#define mset(mas,val) memset(mas,val,sizeof(mas))
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

#define forn(i,n) for (int i=0; i<int(n); ++i)
#define fornd(i,n) for (int i=int(n)-1; i>=0; --i)
#define forab(i,a,b) for (int i=int(a); i<int(b); ++i)

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int INF = (int) 1e9;
const long long INF64 = (long long) 1e18;
const long double eps = 1e-9;
const long double pi = 3.14159265358979323846;

string s;
bool read()
{
	return (cin >> s);
}

int dp[3000][3000];
int p[3000][3000];
int calc(int lf, int rg) {
	int &ans = dp[lf][rg];
	int &pp = p[lf][rg];
	if (ans != -1) return ans;
	if (lf > rg) return ans = 0;
	if (lf == rg) return ans = 1;
	ans = calc(lf + 1, rg - 1);
	pp = 1;
	if (s[lf] == s[rg]) ans += 2;
	if (calc(lf + 1, rg) > ans) ans = calc(lf + 1, rg), pp = 2;
	if (calc(lf, rg - 1) > ans) ans = calc(lf, rg - 1), pp = 3;
	return ans;
}
string get(int lf, int rg) {
	string res = "";
	if (lf == rg) {
		res += s[lf];
		return res;
	}
	if (lf > rg) return res;
	calc(lf, rg);
	int pp = p[lf][rg];
	if (pp == 1) {
		res = get(lf + 1, rg - 1);
		if (s[lf] == s[rg]) {
			res = s[lf] + res + s[lf];
		}
		return res;
	}
	if (pp == 2) {
		return get(lf + 1, rg);
	}
	if (pp == 3) {
		return get(lf, rg - 1);
	}
	assert(false);
	return res;
}
void solve()
{
	map<char, int> cnt;
	forn(i, sz(s)) {
		cnt[s[i]]++;
	}
	for(map<char, int>::iterator it = cnt.begin(); it != cnt.end(); it++) {
		if (it->second >= 100) {
			forn(j, 100) {
				printf("%c", it->first);
				puts("");
			}
			return;
		}
	}
	mset(dp, -1);
	string ans = get(0, sz(s) - 1);
	if (sz(ans) <= 100) {
		puts(ans.c_str());
		return;
	}
	if (sz(ans) % 2 == 1) {
		int len = sz(ans) / 2;
		ans = ans.substr(0, len);
		string tt = ans;
		reverse(all(tt));
		ans += tt;
	}
	while (sz(ans) <= 100) {
		ans = ans.substr(1);
		ans.pop_back();
	}
	assert(ans.size() <= 100);
	puts(ans.c_str());
}
int main()
{
 while (read()) solve();
}


#define _CRT_SECURE_NO_DEPRECATE
#define _SECURE_SCL 0
#pragma comment(linker, "/STACK:200000000")

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <fstream>
#include <iostream>
#include <map>
#include <memory.h>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <list>
#include <string>
#include <iomanip>
#include <sstream>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;

#define pb push_back
#define mp make_pair
#define mset(mas,val) memset(mas,val,sizeof(mas))
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

#define forn(i,n) for (int i=0; i<int(n); ++i)
#define fornd(i,n) for (int i=int(n)-1; i>=0; --i)
#define forab(i,a,b) for (int i=int(a); i<int(b); ++i)

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int INF = (int) 1e9;
const long long INF64 = (long long) 1e18;
const long double eps = 1e-9;
const long double pi = 3.14159265358979323846;

string s;
bool read()
{
	return (cin >> s);
}

int dp[3000][3000];
int p[3000][3000];
int calc(int lf, int rg) {
	int &ans = dp[lf][rg];
	int &pp = p[lf][rg];
	if (ans != -1) return ans;
	if (lf > rg) return ans = 0;
	if (lf == rg) return ans = 1;
	ans = calc(lf + 1, rg - 1);
	pp = 1;
	if (s[lf] == s[rg]) ans += 2;
	if (calc(lf + 1, rg) > ans) ans = calc(lf + 1, rg), pp = 2;
	if (calc(lf, rg - 1) > ans) ans = calc(lf, rg - 1), pp = 3;
	return ans;
}
string get(int lf, int rg) {
	string res = "";
	if (lf == rg) {
		res += s[lf];
		return res;
	}
	if (lf > rg) return res;
	calc(lf, rg);
	int pp = p[lf][rg];
	if (pp == 1) {
		res = get(lf + 1, rg - 1);
		if (s[lf] == s[rg]) {
			res = s[lf] + res + s[lf];
		}
		return res;
	}
	if (pp == 2) {
		return get(lf + 1, rg);
	}
	if (pp == 3) {
		return get(lf, rg - 1);
	}
	return res;
}
void solve()
{
	map<char, int> cnt;
	forn(i, sz(s)) {
		cnt[s[i]]++;
	}
	for(map<char, int>::iterator it = cnt.begin(); it != cnt.end(); it++) {
		if (it->second >= 100) {
			forn(j, 100) {
				printf("%c", it->first);
			}
			return;
		}
	}
	mset(dp, -1);
	string ans = get(0, sz(s) - 1);
	if (sz(ans) <= 100) {
		puts(ans.c_str());
		return;
	}
	if (sz(ans) % 2 == 1) {
		int len = sz(ans) / 2;
		ans = ans.substr(0, len);
		string tt = ans;
		reverse(all(tt));
		ans += tt;
	}
	while (sz(ans) <= 100) {
		ans = ans.substr(1);
		ans.pop_back();
	}
	assert(ans.size() <= 100);
	puts(ans.c_str());
}
int main()
{
 while (read()) solve();
}


#define _CRT_SECURE_NO_DEPRECATE
#define _SECURE_SCL 0
#pragma comment(linker, "/STACK:200000000")

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <fstream>
#include <iostream>
#include <map>
#include <memory.h>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <list>
#include <string>
#include <iomanip>
#include <sstream>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;

#define pb push_back
#define mp make_pair
#define mset(mas,val) memset(mas,val,sizeof(mas))
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

#define forn(i,n) for (int i=0; i<int(n); ++i)
#define fornd(i,n) for (int i=int(n)-1; i>=0; --i)
#define forab(i,a,b) for (int i=int(a); i<int(b); ++i)

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int INF = (int) 1e9;
const long long INF64 = (long long) 1e18;
const long double eps = 1e-9;
const long double pi = 3.14159265358979323846;

string s;
bool read()
{
	return (cin >> s);
}

int dp[3000][3000];
int p[3000][3000];
int calc(int lf, int rg) {
	int &ans = dp[lf][rg];
	int &pp = p[lf][rg];
	if (ans != -1) return ans;
	if (lf > rg) return ans = 0;
	if (lf == rg) return ans = 1;
	ans = calc(lf + 1, rg - 1);
	pp = 1;
	if (s[lf] == s[rg]) ans += 2;
	if (calc(lf + 1, rg) > ans) ans = calc(lf + 1, rg), pp = 2;
	if (calc(lf, rg - 1) > ans) ans = calc(lf, rg - 1), pp = 3;
	return ans;
}
string get(int lf, int rg) {
	string res = "";
	if (lf == rg) {
		res += s[lf];
		return res;
	}
	if (lf > rg) return res;
	calc(lf, rg);
	int pp = p[lf][rg];
	if (pp == 1) {
		res = get(lf + 1, rg - 1);
		if (s[lf] == s[rg]) {
			res = s[lf] + res + s[lf];
		}
		return res;
	}
	if (pp == 2) {
		return get(lf + 1, rg);
	}
	if (pp == 3) {
		return get(lf, rg - 1);
	}
	assert(false);
	return res;
}
void solve()
{
	map<char, int> cnt;
	forn(i, sz(s)) {
		cnt[s[i]]++;
	}
	for(map<char, int>::iterator it = cnt.begin(); it != cnt.end(); it++) {
		if (it->second >= 100) {
			forn(j, 100) {
				printf("%c", it->first);
				puts("");
				return;
			}
		}
	}
	mset(dp, -1);
	string ans = get(0, sz(s) - 1);
	if (sz(ans) <= 100) {
		puts(ans.c_str());
		return;
	}
	if (sz(ans) % 2 == 1) {
		int len = sz(ans) / 2;
		ans = ans.substr(0, len);
		string tt = ans;
		reverse(all(tt));
		ans += tt;
	}
	if (sz(ans) % 2 == 0) {
		while (sz(ans) <= 100) {
			ans = ans.substr(1);
			ans.pop_back();
		}
	}
	puts(ans.c_str());
}
int main()
{
 while (read()) solve();
}


#define _CRT_SECURE_NO_DEPRECATE
#define _SECURE_SCL 0
#pragma comment(linker, "/STACK:200000000")

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <fstream>
#include <iostream>
#include <map>
#include <memory.h>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <list>
#include <string>
#include <iomanip>
#include <sstream>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;

#define pb push_back
#define mp make_pair
#define mset(mas,val) memset(mas,val,sizeof(mas))
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

#define forn(i,n) for (int i=0; i<int(n); ++i)
#define fornd(i,n) for (int i=int(n)-1; i>=0; --i)
#define forab(i,a,b) for (int i=int(a); i<int(b); ++i)

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int INF = (int) 1e9;
const long long INF64 = (long long) 1e18;
const long double eps = 1e-9;
const long double pi = 3.14159265358979323846;

string s;
bool read()
{
	return (cin >> s);
}

int dp[3000][3000];
int p[3000][3000];
int calc(int lf, int rg) {
	int &ans = dp[lf][rg];
	int &pp = p[lf][rg];
	if (ans != -1) return ans;
	if (lf > rg) return ans = 0;
	if (lf == rg) return ans = 1;
	ans = calc(lf + 1, rg - 1);
	pp = 1;
	if (s[lf] == s[rg]) ans += 2;
	if (calc(lf + 1, rg) > ans) ans = calc(lf + 1, rg), pp = 2;
	if (calc(lf, rg - 1) > ans) ans = calc(lf, rg - 1), pp = 3;
	return ans;
}
string get(int lf, int rg) {
	string res = "";
	if (lf == rg) {
		res += s[lf];
		return res;
	}
	if (lf > rg) return res;
	calc(lf, rg);
	int pp = p[lf][rg];
	if (pp == 1) {
		res = get(lf + 1, rg - 1);
		if (s[lf] == s[rg]) {
			res = s[lf] + res + s[lf];
		}
		return res;
	}
	if (pp == 2) {
		return get(lf + 1, rg);
	}
	if (pp == 3) {
		return get(lf, rg - 1);
	}
}
void solve()
{
	map<char, int> cnt;
	forn(i, sz(s)) {
		cnt[s[i]]++;
	}
	for(map<char, int>::iterator it = cnt.begin(); it != cnt.end(); it++) {
		if (it->second >= 100) {
			forn(j, 100) {
				printf("%c", it->first);
				puts("");
				return;
			}
		}
	}
	mset(dp, -1);
	string ans = get(0, sz(s) - 1);
	if (sz(ans) < 100) {
		puts(ans.c_str());
		return;
	}
	if (sz(ans) % 2 == 1) {
		int len = sz(ans) / 2;
		ans = ans.substr(0, len);
		string tt = ans;
		reverse(all(tt));
		ans += tt;
	}
	if (sz(ans) % 2 == 0) {
		while (sz(ans) <= 100) {
			ans = s.substr(1);
			ans.pop_back();
		}
		puts(ans.c_str());
	}
	puts(ans.c_str());
}
int main()
{
 while (read()) solve();
}


#define _CRT_SECURE_NO_DEPRECATE
#define _SECURE_SCL 0
#pragma comment(linker, "/STACK:200000000")

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <fstream>
#include <iostream>
#include <map>
#include <memory.h>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <list>
#include <string>
#include <iomanip>
#include <sstream>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;

#define pb push_back
#define mp make_pair
#define mset(mas,val) memset(mas,val,sizeof(mas))
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

#define forn(i,n) for (int i=0; i<int(n); ++i)
#define fornd(i,n) for (int i=int(n)-1; i>=0; --i)
#define forab(i,a,b) for (int i=int(a); i<int(b); ++i)

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int INF = (int) 1e9;
const long long INF64 = (long long) 1e18;
const long double eps = 1e-9;
const long double pi = 3.14159265358979323846;

string s;
bool read()
{
	return (cin >> s);
}

int dp[3000][3000];
int p[3000][3000];
int calc(int lf, int rg) {
	int &ans = dp[lf][rg];
	int &pp = p[lf][rg];
	if (ans != -1) return ans;
	if (lf > rg) return ans = 0;
	if (lf == rg) return ans = 1;
	ans = calc(lf + 1, rg - 1);
	pp = 1;
	if (s[lf] == s[rg]) ans += 2;
	if (calc(lf + 1, rg) > ans) ans = calc(lf + 1, rg), pp = 2;
	if (calc(lf, rg - 1) > ans) ans = calc(lf, rg - 1), pp = 3;
	return ans;
}
string get(int lf, int rg) {
	string res = "";
	if (lf == rg) {
		res += s[lf];
		return res;
	}
	if (lf > rg) return res;
	calc(lf, rg);
	int pp = p[lf][rg];
	if (pp == 1) {
		res = get(lf + 1, rg - 1);
		if (s[lf] == s[rg]) {
			res = s[lf] + res + s[lf];
		}
		return res;
	}
	if (pp == 2) {
		return get(lf + 1, rg);
	}
	if (pp == 3) {
		return get(lf, rg - 1);
	}
	return res;
}
void solve()
{
	map<char, int> cnt;
	forn(i, sz(s)) {
		cnt[s[i]]++;
	}
	for(map<char, int>::iterator it = cnt.begin(); it != cnt.end(); it++) {
		if (it->second >= 100) {
			forn(j, 100) {
				printf("%c", it->first);
			}
			return;
		}
	}
	mset(dp, -1);
	string ans = get(0, sz(s) - 1);
	if (sz(ans) <= 100) {
		puts(ans.c_str());
		return;
	}
	if (sz(ans) % 2 == 1) {
		int len = sz(ans) / 2;
		ans = ans.substr(0, len);
		string tt = ans;
		reverse(all(tt));
		ans += tt;
	}
	while (sz(ans) > 100) {
		ans = ans.substr(1);
		ans.pop_back();
	}
	puts(ans.c_str());
}
int main()
{
 while (read()) solve();
}


#define _CRT_SECURE_NO_DEPRECATE
#define _SECURE_SCL 0
#pragma comment(linker, "/STACK:200000000")

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <fstream>
#include <iostream>
#include <map>
#include <memory.h>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <list>
#include <string>
#include <iomanip>
#include <sstream>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;

#define pb push_back
#define mp make_pair
#define mset(mas,val) memset(mas,val,sizeof(mas))
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

#define forn(i,n) for (int i=0; i<int(n); ++i)
#define fornd(i,n) for (int i=int(n)-1; i>=0; --i)
#define forab(i,a,b) for (int i=int(a); i<int(b); ++i)

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int INF = (int) 1e9;
const long long INF64 = (long long) 1e18;
const long double eps = 1e-9;
const long double pi = 3.14159265358979323846;

string s;
bool read()
{
	return (cin >> s);
}

int dp[3000][3000];
int p[3000][3000];
int calc(int lf, int rg) {
	int &ans = dp[lf][rg];
	int &pp = p[lf][rg];
	if (ans != -1) return ans;
	if (lf > rg) return ans = 0;
	if (lf == rg) return ans = 1;
	ans = calc(lf + 1, rg - 1);
	pp = 1;
	if (s[lf] == s[rg]) ans += 2;
	if (calc(lf + 1, rg) > ans) ans = calc(lf + 1, rg), pp = 2;
	if (calc(lf, rg - 1) > ans) ans = calc(lf, rg - 1), pp = 3;
	return ans;
}
string get(int lf, int rg) {
	string res = "";
	if (lf == rg) {
		res += s[lf];
		return res;
	}
	if (lf > rg) return res;
	calc(lf, rg);
	int pp = p[lf][rg];
	if (pp == 1) {
		res = get(lf + 1, rg - 1);
		if (s[lf] == s[rg]) {
			res = s[lf] + res + s[lf];
		}
		return res;
	}
	if (pp == 2) {
		return get(lf + 1, rg);
	}
	if (pp == 3) {
		return get(lf, rg - 1);
	}
	assert(false);
	return res;
}
void solve()
{
	map<char, int> cnt;
	forn(i, sz(s)) {
		cnt[s[i]]++;
	}
	for(map<char, int>::iterator it = cnt.begin(); it != cnt.end(); it++) {
		if (it->second >= 100) {
			forn(j, 100) {
				printf("%c", it->first);
				puts("");
				return;
			}
		}
	}
	mset(dp, -1);
	string ans = get(0, sz(s) - 1);
	if (sz(ans) <= 100) {
		puts(ans.c_str());
		return;
	}
	if (sz(ans) % 2 == 1) {
		int len = sz(ans) / 2;
		ans = ans.substr(0, len);
		string tt = ans;
		reverse(all(tt));
		ans += tt;
	}
	if (sz(ans) % 2 == 0) {
		while (sz(ans) <= 100) {
			ans = ans.substr(1);
			ans.pop_back();
		}
		puts(ans.c_str());
	}
	puts(ans.c_str());
}
int main()
{
 while (read()) solve();
}


#define _CRT_SECURE_NO_DEPRECATE
#define _SECURE_SCL 0
#pragma comment(linker, "/STACK:200000000")

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <fstream>
#include <iostream>
#include <map>
#include <memory.h>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <list>
#include <string>
#include <iomanip>
#include <sstream>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;

#define pb push_back
#define mp make_pair
#define mset(mas,val) memset(mas,val,sizeof(mas))
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

#define forn(i,n) for (int i=0; i<int(n); ++i)
#define fornd(i,n) for (int i=int(n)-1; i>=0; --i)
#define forab(i,a,b) for (int i=int(a); i<int(b); ++i)

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int INF = (int) 1e9;
const long long INF64 = (long long) 1e18;
const long double eps = 1e-9;
const long double pi = 3.14159265358979323846;

string s;
bool read()
{
	return (cin >> s);
}

int dp[3000][3000];
int p[3000][3000];
int calc(int lf, int rg) {
	int &ans = dp[lf][rg];
	int &pp = p[lf][rg];
	if (ans != -1) return ans;
	if (lf > rg) return ans = 0;
	if (lf == rg) return ans = 1;
	ans = calc(lf + 1, rg - 1);
	pp = 1;
	if (s[lf] == s[rg]) ans += 2;
	if (calc(lf + 1, rg) > ans) ans = calc(lf + 1, rg), pp = 2;
	if (calc(lf, rg - 1) > ans) ans = calc(lf, rg - 1), pp = 3;
	return ans;
}
string get(int lf, int rg) {
	string res = "";
	if (lf == rg) {
		res += s[lf];
		return res;
	}
	if (lf > rg) return res;
	calc(lf, rg);
	int pp = p[lf][rg];
	if (pp == 1) {
		res = get(lf + 1, rg - 1);
		if (s[lf] == s[rg]) {
			res = s[lf] + res + s[lf];
		}
		return res;
	}
	if (pp == 2) {
		return get(lf + 1, rg);
	}
	if (pp == 3) {
		return get(lf, rg - 1);
	}
	assert(false);
	return res;
}
void solve()
{
	map<char, int> cnt;
	forn(i, sz(s)) {
		cnt[s[i]]++;
	}
	for(map<char, int>::iterator it = cnt.begin(); it != cnt.end(); it++) {
		if (it->second >= 100) {
			forn(j, 100) {
				printf("%c", it->first);
				puts("");
				return;
			}
		}
	}
	mset(dp, -1);
	string ans = get(0, sz(s) - 1);
	if (sz(ans) <= 100) {
		puts(ans.c_str());
		return;
	}
	if (sz(ans) % 2 == 1) {
		int len = sz(ans) / 2;
		ans = ans.substr(0, len);
		string tt = ans;
		reverse(all(tt));
		ans += tt;
	}
	if (sz(ans) % 2 == 0) {
		while (sz(ans) <= 100) {
			ans = s.substr(1);
			ans.pop_back();
		}
		puts(ans.c_str());
	}
	puts(ans.c_str());
}
int main()
{
 while (read()) solve();
}


#define _CRT_SECURE_NO_DEPRECATE
#define _SECURE_SCL 0
#pragma comment(linker, "/STACK:200000000")

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <fstream>
#include <iostream>
#include <map>
#include <memory.h>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <list>
#include <string>
#include <iomanip>
#include <sstream>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;

#define pb push_back
#define mp make_pair
#define mset(mas,val) memset(mas,val,sizeof(mas))
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

#define forn(i,n) for (int i=0; i<int(n); ++i)
#define fornd(i,n) for (int i=int(n)-1; i>=0; --i)
#define forab(i,a,b) for (int i=int(a); i<int(b); ++i)

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int INF = (int) 1e9;
const long long INF64 = (long long) 1e18;
const long double eps = 1e-9;
const long double pi = 3.14159265358979323846;

string s;
bool read()
{
	return (cin >> s);
}

int dp[3000][3000];
int p[3000][3000];
int calc(int lf, int rg) {
	int &ans = dp[lf][rg];
	int &pp = p[lf][rg];
	if (ans != -1) return ans;
	if (lf > rg) return ans = 0;
	if (lf == rg) return ans = 1;
	ans = calc(lf + 1, rg - 1);
	pp = 1;
	if (s[lf] == s[rg]) ans += 2;
	if (calc(lf + 1, rg) > ans) ans = calc(lf + 1, rg), pp = 2;
	if (calc(lf, rg - 1) > ans) ans = calc(lf, rg - 1), pp = 3;
	return ans;
}
string get(int lf, int rg) {
	string res = "";
	if (lf == rg) {
		res += s[lf];
		return res;
	}
	if (lf > rg) return res;
	calc(lf, rg);
	int pp = p[lf][rg];
	if (pp == 1) {
		res = get(lf + 1, rg - 1);
		if (s[lf] == s[rg]) {
			res = s[lf] + res + s[lf];
		}
		return res;
	}
	if (pp == 2) {
		return get(lf + 1, rg);
	}
	if (pp == 3) {
		return get(lf, rg - 1);
	}
	assert(false);
	return res;
}
void solve()
{
	map<char, int> cnt;
	forn(i, sz(s)) {
		cnt[s[i]]++;
	}
	for(map<char, int>::iterator it = cnt.begin(); it != cnt.end(); it++) {
		if (it->second >= 100) {
			forn(j, 100) {
				printf("%c", it->first);
			}
			return;
		}
	}
	mset(dp, -1);
	string ans = get(0, sz(s) - 1);
	if (sz(ans) <= 100) {
		puts(ans.c_str());
		return;
	}
	if (sz(ans) % 2 == 1) {
		int len = sz(ans) / 2;
		ans = ans.substr(0, len);
		string tt = ans;
		reverse(all(tt));
		ans += tt;
	}
	while (sz(ans) <= 100) {
		ans = ans.substr(1);
		ans.pop_back();
	}
	assert(ans.size() <= 100);
	puts(ans.c_str());
}
int main()
{
 while (read()) solve();
}


#define _CRT_SECURE_NO_DEPRECATE
#define _SECURE_SCL 0
#pragma comment(linker, "/STACK:200000000")

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <fstream>
#include <iostream>
#include <map>
#include <memory.h>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <list>
#include <string>
#include <iomanip>
#include <sstream>
#include <vector>
#include <utility>
#include <cmath>
using namespace std;

#define pb push_back
#define mp make_pair
#define mset(mas,val) memset(mas,val,sizeof(mas))
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

#define forn(i,n) for (int i=0; i<int(n); ++i)
#define fornd(i,n) for (int i=int(n)-1; i>=0; --i)
#define forab(i,a,b) for (int i=int(a); i<int(b); ++i)

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int INF = (int) 1e9;
const long long INF64 = (long long) 1e18;
const long double eps = 1e-9;
const long double pi = 3.14159265358979323846;

string s;
bool read()
{
	return (cin >> s);
}

int dp[3000][3000];
int p[3000][3000];
int calc(int lf, int rg) {
	int &ans = dp[lf][rg];
	int &pp = p[lf][rg];
	if (ans != -1) return ans;
	if (lf > rg) return ans = 0;
	if (lf == rg) return ans = 1;
	ans = calc(lf + 1, rg - 1);
	pp = 1;
	if (s[lf] == s[rg]) ans += 2;
	if (calc(lf + 1, rg) > ans) ans = calc(lf + 1, rg), pp = 2;
	if (calc(lf, rg - 1) > ans) ans = calc(lf, rg - 1), pp = 3;
	return ans;
}
string get(int lf, int rg) {
	string res = "";
	if (lf == rg) {
		res += s[lf];
		return res;
	}
	if (lf > rg) return res;
	calc(lf, rg);
	int pp = p[lf][rg];
	if (pp == 1) {
		res = get(lf + 1, rg - 1);
		if (s[lf] == s[rg]) {
			res = s[lf] + res + s[lf];
		}
		return res;
	}
	if (pp == 2) {
		return get(lf + 1, rg);
	}
	if (pp == 3) {
		return get(lf, rg - 1);
	}
	return res;
}
void solve()
{
	map<char, int> cnt;
	forn(i, sz(s)) {
		cnt[s[i]]++;
	}
	for(map<char, int>::iterator it = cnt.begin(); it != cnt.end(); it++) {
		if (it->second >= 100) {
			forn(j, 100) {
				printf("%c", it->first);
			}
			return;
		}
	}
	mset(dp, -1);
	string ans = get(0, sz(s) - 1);
	if (sz(ans) <= 100) {
		puts(ans.c_str());
		return;
	}
	if (sz(ans) % 2 == 1) {
		int len = sz(ans) / 2;
		ans = ans.substr(0, len);
		string tt = ans;
		reverse(all(tt));
		ans += tt;
	}
	while (sz(ans) <= 100) {
		ans = ans.substr(1);
		ans.pop_back();
	}
	puts(ans.c_str());
}
int main()
{
 while (read()) solve();
}


#pragma comment(linker, "/STACK:500000000")
#include <functional>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <sstream>
#include <ctype.h>
#include <stdio.h>
#include <bitset>
#include <vector>
#include <string>
#include <math.h>
#include <time.h>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#define Int long long
#define INF 0x3F3F3F3F
#define eps 1e-9
using namespace std;

#define N 3009

int dp[N][N];
int n;
string s;
int Prev[N][N][2];

int f(int L, int R)
{
	if (L < 0 || R >= n)
		return 0;
	int &res = dp[L][R];
	if (res == -1)
	{
		Prev[L][R][0] = L - 1;
		Prev[L][R][1] = R;
		res = f(L - 1, R);

		int nw = f(L, R + 1);
		if (nw > res)
		{
			res = nw;
			Prev[L][R][0] = L;
			Prev[L][R][1] = R + 1;
		}

		if (s[L] == s[R])
		{
			int nw = f(L - 1, R + 1) + 2;
			if (nw > res)
			{
				res = nw;
				Prev[L][R][0] = L - 1;
				Prev[L][R][1] = R + 1;
			}
		}
	}
	return res;
}

int main()
{
	cin >> s;
	if (s.size() > 3000)
	{
		vector<int> cnt(26, 0);
		for(int i = 0; i < s.size(); i++)
			cnt[s[i] - 'a']++;
		for(int i = 0; i < 26; i++)
		{
			if (cnt[i] >= 100)
			{
				cout << string(100, char(i + 'a')) << endl;
				return 0;
			}
		}
		throw 1;
	}

	memset(dp, -1, sizeof(dp));
	n = s.size();
	int res = 0, I, J;
	for(int i = 0; i < n; i++)
	{
		for(int j = i + 1; j < n; j++)
		{
			if (f(i, j) > res)
			{
				res = f(i, j);
				I = i;
				J = j;
			}
		}
	}
	if (res <= 1)
	{
		cout << s[0] << endl;
		return 0;
	}
	string Res;
	while(I >= 0 && J < n)
	{
		int ni = Prev[I][J][0];
		int nj = Prev[I][J][1];
		if (ni == I - 1 && nj == J + 1)
			Res += s[I];
		I = ni;
		J = nj;
	}
	reverse(Res.begin(), Res.end());
	if (Res.size() > 50)
		Res.resize(50);
	for(int i = Res.size() - 1; i >= 0; i--)
		Res.push_back(Res[i]);

	res = 0, I, J;
	for(int i = 0; i < n; i++)
	{
		for(int j = i + 2; j < n; j++)
		{
			if (f(i, j)+1 > res)
			{
				res = f(i, j)+1;
				I = i;
				J = j;
			}
		}
	}

	if (Res.size() == 50 || res < Res.size())
	{
		cout << Res << endl;
		return 0;
	}

	Res = "";
	char c = s[I + 1];
	while(I >= 0 && J < n)
	{
		int ni = Prev[I][J][0];
		int nj = Prev[I][J][1];
		if (ni == I - 1 && nj == J + 1)
			Res += s[I];
		I = ni;
		J = nj;
	}
	reverse(Res.begin(), Res.end());
	Res.push_back(c);
	for(int i = Res.size() - 2; i >= 0; i--)
		Res.push_back(Res[i]);
	cout << Res << endl;
}


#pragma comment(linker, "/STACK:500000000")
#include <functional>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <sstream>
#include <ctype.h>
#include <stdio.h>
#include <bitset>
#include <vector>
#include <string>
#include <math.h>
#include <time.h>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#define Int long long
#define INF 0x3F3F3F3F
#define eps 1e-9
using namespace std;

#define N 3009

int dp[N][N];
int n;
string s;
int Prev[N][N][2];

int f(int L, int R)
{
	if (L < 0 || R >= n)
		return 0;
	int &res = dp[L][R];
	if (res == -1)
	{
		Prev[L][R][0] = L - 1;
		Prev[L][R][1] = R;
		res = f(L - 1, R);

		int nw = f(L, R + 1);
		if (nw > res)
		{
			res = nw;
			Prev[L][R][0] = L;
			Prev[L][R][1] = R + 1;
		}

		if (s[L] == s[R])
		{
			int nw = f(L - 1, R + 1) + 2;
			if (nw > res)
			{
				res = nw;
				Prev[L][R][0] = L - 1;
				Prev[L][R][1] = R + 1;
			}
		}
	}
	return res;
}

int main()
{
	cin >> s;
	if (s.size() > 3000)
	{
		vector<int> cnt(26, 0);
		for(int i = 0; i < s.size(); i++)
			cnt[s[i] - 'a']++;
		for(int i = 0; i < 26; i++)
		{
			if (cnt[i] >= 100)
			{
				cout << string(100, char(i + 'a')) << endl;
				return 0;
			}
		}
		throw 1;
	}

	memset(dp, -1, sizeof(dp));
	n = s.size();
	int res = 0, I, J;
	for(int i = 0; i < n; i++)
	{
		for(int j = i + 1; j < n; j++)
		{
			if (f(i, j) > res)
			{
				res = f(i, j);
				I = i;
				J = j;
			}
		}
	}
	if (res <= 1)
	{
		cout << s[0] << endl;
		return 0;
	}
	string Res;
	while(I >= 0 && J < n)
	{
		int ni = Prev[I][J][0];
		int nj = Prev[I][J][1];
		if (ni == I - 1 && nj == J + 1)
			Res += s[I];
		I = ni;
		J = nj;
	}
	reverse(Res.begin(), Res.end());
	if (Res.size() > 50)
		Res.resize(50);
	for(int i = Res.size() - 1; i >= 0; i--)
		Res.push_back(Res[i]);

	res = 0, I, J;
	for(int i = 0; i < n; i++)
	{
		for(int j = i + 2; j < n; j++)
		{
			if (f(i, j)+1 > res)
			{
				res = f(i, j)+1;
				I = i;
				J = j;
			}
		}
	}

	if (Res.size() == 100 || res < Res.size())
	{
		cout << Res << endl;
		return 0;
	}

	Res = "";
	char c = s[I + 1];
	while(I >= 0 && J < n)
	{
		int ni = Prev[I][J][0];
		int nj = Prev[I][J][1];
		if (ni == I - 1 && nj == J + 1)
			Res += s[I];
		I = ni;
		J = nj;
	}
	reverse(Res.begin(), Res.end());
	Res.push_back(c);
	for(int i = Res.size() - 2; i >= 0; i--)
		Res.push_back(Res[i]);
	cout << Res << endl;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define FILL(A,value) memset(A,value,sizeof(A))
#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair

typedef long long Int;
typedef vector <int> VI;
typedef pair <int, int> PII;

const int INF = 1000000000;
const int MAX = 1 << 16;
const int BASE = 1000000000;
const int MAX2 = 101;

int n;
char S[MAX];
int R[MAX2+1];
int L[MAX][47];
int P[MAX][MAX2+1];

int main()
{
    scanf("%s", S);
    n = strlen(S);
    FOR (i,0,26)
        L[0][i] = -1;
    FOR (i,1,n+1)
    {
        FOR (j,0,26)
            L[i][j] = L[i-1][j];
        L[i][S[i-1] - 'a'] = i-1;
    }

    FOR (i,1,MAX2)
        R[i] = -1;
    FOR (i,0,MAX)
        FOR (j,0,MAX2)
            P[i][j] = -1;
    R[0] = n;
    FOR (i,0,n)
    {
        FOR (j,0,MAX2)
            P[i+1][j] = P[i][j];
        for (int j = MAX2-1; j >= 0; --j)
        {
            if (R[j] == -1)
                continue;
            int pos = L[R[j]][S[i] - 'a'];
            if (pos < i)
                continue;
            int cnt = (pos > i ? 2 : 1);
            if (j+cnt < MAX2 && R[j+cnt] < pos)
            {
                R[j+cnt] = pos;
                P[i+1][j+cnt] = i;
            }
        }
    }
    int res = 0;
    FOR (i,1,101)
        if (R[i] > -1)
            res = i;
    string s = "";
    int x = n, y = res;
    while (x >= 0)
    {
        int xx = P[x][y];
        int yy = y == res ? ((y % 2 == 0) ? y - 2 : y - 1) : y - 2;
        if (xx >= 0)
            s += S[xx];
        x = xx;
        y = yy;
    }
    string t = s;
    reverse(ALL(s));
    if (res % 2 == 1)
        t.erase(0, 1);
    s += t;
    cout << s << endl;

    return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

int dp[3000][3000] = {0};

int main() {
	//freopen("input.txt", "r", stdin);

	string s;
	cin >> s;
	int n = (int)s.size();

	if ((int)s.size() >= 2600) {
		int cnt[300] = {0};
		for (int i = 0; i < (int)s.size(); ++i) {
			++cnt[s[i]];
		}

		for (char ch = 'a'; ch <= 'z'; ++ch) {
			if (cnt[ch] >= 100) {
				for (int i = 0; i < 100; ++i) {
					cout << ch;
				}
				cout << endl;
				exit(1);

				return 0;
			}
		}
	}

	vector< vector<int> > left(n, vector<int>(300, -1));
	vector< vector<int> > right(n, vector<int>(300, -1));

	for (int i = 0; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			if (left[i][s[j]] == -1) {
				left[i][s[j]] = j;
			}
		}
	}

	for (int i = 1; i < n; ++i) {
		for (int j = i - 1; j >= 0; --j) {
			if (right[i][s[j]] == -1) {
				right[i][s[j]] = j;
			}
		}
	}

	int bestL = 0;
	int bestR = 0;
	for (int length = 1; length <= n; ++length) {
		for (int L = 0; L + length - 1 < n; ++L ) {
			int R = L + length - 1;
			if (L == R) {
				dp[L][R] = 1;
				continue;
			}

			if (s[L] == s[R]) {
				int best = 0;
				for (char ch = 'a'; ch <= 'z'; ++ch) {
					int L1 = left[L][ch];
					int R1 = right[R][ch];
					if (L1 <= R1 && R1 != -1 && L1 != -1) {
						if (dp[L1][R1] > best) {
							best = dp[L1][R1];
						}
					}
				}

				dp[L][R] = best + 2;
				if (dp[L][R] > dp[bestL][bestR]) {
					bestL = L;
					bestR = R;
				}

			}
		}
	}

	string ans;

	int cnt = 0;

	while (dp[bestL][bestR] > 1) {

		ans.push_back(s[bestL]);
		for (char ch = 'a'; ch <= 'z'; ++ch) {
			int L1 = left[bestL][ch];
			int R1 = right[bestR][ch];
			if (L1 <= R1 && R1 != -1 && L1 != -1) {
				if (dp[L1][R1] == dp[bestL][bestR] - 2) {
					bestL = L1;
					bestR = R1;
					break;
				}
			}

		}
	}

	if ((int)ans.size() >= 50) {
		for (int i = 0; i < 50; ++i) {
			cout << ans[i];
		}
		for (int i = 50 - 1; i >= 0; --i) {
			cout << ans[i];
		}
	} else {
		for (int i = 0; i < (int)ans.size(); ++i) {
			cout << ans[i];
		}
		if (dp[bestL][bestR] == 1) {
			cout << s[bestL];
		}
		for (int i = (int)ans.size() - 1; i >= 0; --i) {
			cout << ans[i];
		}
	}

	return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

int dp[3000][3000] = {0};

int main() {
	//freopen("input.txt", "r", stdin);

	string s;
	cin >> s;
	int n = (int)s.size();

	if ((int)s.size() >= 2600) {

		int cnt[300] = {0};
		for (int i = 0; i < (int)s.size(); ++i) {
			++cnt[s[i]];
		}

		for (char ch = 'a'; ch <= 'z'; ++ch) {
			if (cnt[ch] >= 100) {
				for (int i = 0; i < 100; ++i) {
					cout << ch;
				}

				return 0;
			}
		}
	}

	vector< vector<int> > left(n, vector<int>(300, -1));
	vector< vector<int> > right(n, vector<int>(300, -1));

	for (int i = 0; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			if (left[i][s[j]] == -1) {
				left[i][s[j]] = j;
			}
		}
	}

	for (int i = 1; i < n; ++i) {
		for (int j = i - 1; j >= 0; --j) {
			if (right[i][s[j]] == -1) {
				right[i][s[j]] = j;
			}
		}
	}

	int bestL = 0;
	int bestR = 0;
	for (int length = 1; length <= n; ++length) {
		for (int L = 0; L + length - 1 < n; ++L ) {
			int R = L + length - 1;
			if (L == R) {
				dp[L][R] = 1;
				continue;
			}

			if (s[L] == s[R]) {
				int best = 0;
				for (char ch = 'a'; ch <= 'z'; ++ch) {
					int L1 = left[L][ch];
					int R1 = right[R][ch];
					if (L1 <= R1 && R1 != -1 && L1 != -1) {
						if (dp[L1][R1] > best) {
							best = dp[L1][R1];
						}
					}
				}

				dp[L][R] = best + 2;
				if (dp[L][R] > dp[bestL][bestR]) {
					bestL = L;
					bestR = R;
				}

			}
		}
	}

	string ans;

	int cnt = 0;

	while (dp[bestL][bestR] > 1) {
		++cnt;

		ans.push_back(s[bestL]);
		if (bestR - bestL == 1) {
			break;
		}
		for (char ch = 'a'; ch <= 'z'; ++ch) {
			int L1 = left[bestL][ch];
			int R1 = right[bestR][ch];
			if (L1 <= R1 && R1 != -1 && L1 != -1) {
				if (dp[L1][R1] == dp[bestL][bestR] - 2) {
					bestL = L1;
					bestR = R1;
					break;
				}
			}

		}
	}

	if ((int)ans.size() >= 50) {
		for (int i = 0; i < 50; ++i) {
			cout << ans[i];
		}
		for (int i = 50 - 1; i >= 0; --i) {
			cout << ans[i];
		}
	} else {
		for (int i = 0; i < (int)ans.size(); ++i) {
			cout << ans[i];
		}
		if (dp[bestL][bestR] == 1) {
			cout << s[bestL];
		}
		for (int i = (int)ans.size() - 1; i >= 0; --i) {
			cout << ans[i];
		}
	}

	return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

int dp[3000][3000] = {0};

int main() {
	//freopen("input.txt", "r", stdin);

	string s;
	cin >> s;
	int n = (int)s.size();

	if ((int)s.size() > 1000) {
		exit(1);
		cout << "hah" << endl;
		return 0;
	}
	if ((int)s.size() >= 2600) {
		exit(1);
		int cnt[300] = {0};
		for (int i = 0; i < (int)s.size(); ++i) {
			++cnt[s[i]];
		}

		for (char ch = 'a'; ch <= 'z'; ++ch) {
			if (cnt[ch] >= 100) {
				for (int i = 0; i < 100; ++i) {
					cout << ch;
				}
				cout << endl;
				exit(1);

				return 0;
			}
		}
	}

	vector< vector<int> > left(n, vector<int>(300, -1));
	vector< vector<int> > right(n, vector<int>(300, -1));

	for (int i = 0; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			if (left[i][s[j]] == -1) {
				left[i][s[j]] = j;
			}
		}
	}

	for (int i = 1; i < n; ++i) {
		for (int j = i - 1; j >= 0; --j) {
			if (right[i][s[j]] == -1) {
				right[i][s[j]] = j;
			}
		}
	}

	int bestL = 0;
	int bestR = 0;
	for (int length = 1; length <= n; ++length) {
		for (int L = 0; L + length - 1 < n; ++L ) {
			int R = L + length - 1;
			if (L == R) {
				dp[L][R] = 1;
				continue;
			}

			if (s[L] == s[R]) {
				int best = 0;
				for (char ch = 'a'; ch <= 'z'; ++ch) {
					int L1 = left[L][ch];
					int R1 = right[R][ch];
					if (L1 <= R1 && R1 != -1 && L1 != -1) {
						if (dp[L1][R1] > best) {
							best = dp[L1][R1];
						}
					}
				}

				dp[L][R] = best + 2;
				if (dp[L][R] > dp[bestL][bestR]) {
					bestL = L;
					bestR = R;
				}

			}
		}
	}

	string ans;

	int cnt = 0;

	while (dp[bestL][bestR] > 1) {

		ans.push_back(s[bestL]);
		for (char ch = 'a'; ch <= 'z'; ++ch) {
			int L1 = left[bestL][ch];
			int R1 = right[bestR][ch];
			if (L1 <= R1 && R1 != -1 && L1 != -1) {
				if (dp[L1][R1] == dp[bestL][bestR] - 2) {
					bestL = L1;
					bestR = R1;
					break;
				}
			}

		}
	}

	if ((int)ans.size() >= 50) {
		for (int i = 0; i < 50; ++i) {
			cout << ans[i];
		}
		for (int i = 50 - 1; i >= 0; --i) {
			cout << ans[i];
		}
	} else {
		for (int i = 0; i < (int)ans.size(); ++i) {
			cout << ans[i];
		}
		if (dp[bestL][bestR] == 1) {
			cout << s[bestL];
		}
		for (int i = (int)ans.size() - 1; i >= 0; --i) {
			cout << ans[i];
		}
	}

	return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

int dp[3000][3000] = {0};

int main() {
	//freopen("input.txt", "r", stdin);

	string s;
	cin >> s;
	int n = (int)s.size();

	if ((int)s.size() >= 2600) {
		exit(1);
		int cnt[300] = {0};
		for (int i = 0; i < (int)s.size(); ++i) {
			++cnt[s[i]];
		}

		for (char ch = 'a'; ch <= 'z'; ++ch) {
			if (cnt[ch] >= 100) {
				for (int i = 0; i < 100; ++i) {
					cout << ch;
				}
				cout << endl;
				exit(1);

				return 0;
			}
		}
	}

	vector< vector<int> > left(n, vector<int>(300, -1));
	vector< vector<int> > right(n, vector<int>(300, -1));

	for (int i = 0; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			if (left[i][s[j]] == -1) {
				left[i][s[j]] = j;
			}
		}
	}

	for (int i = 1; i < n; ++i) {
		for (int j = i - 1; j >= 0; --j) {
			if (right[i][s[j]] == -1) {
				right[i][s[j]] = j;
			}
		}
	}

	int bestL = 0;
	int bestR = 0;
	for (int length = 1; length <= n; ++length) {
		for (int L = 0; L + length - 1 < n; ++L ) {
			int R = L + length - 1;
			if (L == R) {
				dp[L][R] = 1;
				continue;
			}

			if (s[L] == s[R]) {
				int best = 0;
				for (char ch = 'a'; ch <= 'z'; ++ch) {
					int L1 = left[L][ch];
					int R1 = right[R][ch];
					if (L1 <= R1 && R1 != -1 && L1 != -1) {
						if (dp[L1][R1] > best) {
							best = dp[L1][R1];
						}
					}
				}

				dp[L][R] = best + 2;
				if (dp[L][R] > dp[bestL][bestR]) {
					bestL = L;
					bestR = R;
				}

			}
		}
	}

	string ans;

	int cnt = 0;

	while (dp[bestL][bestR] > 1) {

		ans.push_back(s[bestL]);
		for (char ch = 'a'; ch <= 'z'; ++ch) {
			int L1 = left[bestL][ch];
			int R1 = right[bestR][ch];
			if (L1 <= R1 && R1 != -1 && L1 != -1) {
				if (dp[L1][R1] == dp[bestL][bestR] - 2) {
					bestL = L1;
					bestR = R1;
					break;
				}
			}

		}
	}

	if ((int)ans.size() >= 50) {
		for (int i = 0; i < 50; ++i) {
			cout << ans[i];
		}
		for (int i = 50 - 1; i >= 0; --i) {
			cout << ans[i];
		}
	} else {
		for (int i = 0; i < (int)ans.size(); ++i) {
			cout << ans[i];
		}
		if (dp[bestL][bestR] == 1) {
			cout << s[bestL];
		}
		for (int i = (int)ans.size() - 1; i >= 0; --i) {
			cout << ans[i];
		}
	}

	return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

int dp[3000][3000] = {0};

int main() {
	//freopen("input.txt", "r", stdin);

	string s;
	cin >> s;
	int n = (int)s.size();

	if ((int)s.size() > 100) {
		exit(1);
		cout << "hah" << endl;
		return 0;
	}
	if ((int)s.size() >= 2600) {
		exit(1);
		int cnt[300] = {0};
		for (int i = 0; i < (int)s.size(); ++i) {
			++cnt[s[i]];
		}

		for (char ch = 'a'; ch <= 'z'; ++ch) {
			if (cnt[ch] >= 100) {
				for (int i = 0; i < 100; ++i) {
					cout << ch;
				}
				cout << endl;
				exit(1);

				return 0;
			}
		}
	}

	vector< vector<int> > left(n, vector<int>(300, -1));
	vector< vector<int> > right(n, vector<int>(300, -1));

	for (int i = 0; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			if (left[i][s[j]] == -1) {
				left[i][s[j]] = j;
			}
		}
	}

	for (int i = 1; i < n; ++i) {
		for (int j = i - 1; j >= 0; --j) {
			if (right[i][s[j]] == -1) {
				right[i][s[j]] = j;
			}
		}
	}

	int bestL = 0;
	int bestR = 0;
	for (int length = 1; length <= n; ++length) {
		for (int L = 0; L + length - 1 < n; ++L ) {
			int R = L + length - 1;
			if (L == R) {
				dp[L][R] = 1;
				continue;
			}

			if (s[L] == s[R]) {
				int best = 0;
				for (char ch = 'a'; ch <= 'z'; ++ch) {
					int L1 = left[L][ch];
					int R1 = right[R][ch];
					if (L1 <= R1 && R1 != -1 && L1 != -1) {
						if (dp[L1][R1] > best) {
							best = dp[L1][R1];
						}
					}
				}

				dp[L][R] = best + 2;
				if (dp[L][R] > dp[bestL][bestR]) {
					bestL = L;
					bestR = R;
				}

			}
		}
	}

	string ans;

	int cnt = 0;

	while (dp[bestL][bestR] > 1) {

		ans.push_back(s[bestL]);
		for (char ch = 'a'; ch <= 'z'; ++ch) {
			int L1 = left[bestL][ch];
			int R1 = right[bestR][ch];
			if (L1 <= R1 && R1 != -1 && L1 != -1) {
				if (dp[L1][R1] == dp[bestL][bestR] - 2) {
					bestL = L1;
					bestR = R1;
					break;
				}
			}

		}
	}

	if ((int)ans.size() >= 50) {
		for (int i = 0; i < 50; ++i) {
			cout << ans[i];
		}
		for (int i = 50 - 1; i >= 0; --i) {
			cout << ans[i];
		}
	} else {
		for (int i = 0; i < (int)ans.size(); ++i) {
			cout << ans[i];
		}
		if (dp[bestL][bestR] == 1) {
			cout << s[bestL];
		}
		for (int i = (int)ans.size() - 1; i >= 0; --i) {
			cout << ans[i];
		}
	}

	return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

int dp[3000][3000] = {0};

int main() {
	//freopen("input.txt", "r", stdin);

	string s;
	cin >> s;
	int n = (int)s.size();

	if ((int)s.size() >= 26000) {
		int cnt[300] = {0};
		for (int i = 0; i < (int)s.size(); ++i) {
			++cnt[s[i]];
		}

		for (char ch = 'a'; ch <= 'z'; ++ch) {
			if (cnt[ch] >= 100) {
				for (int i = 0; i < 100; ++i) {
					cout << ch;
				}
				cout << endl;
				return 0;
			}
		}
	}

	vector< vector<int> > left(n, vector<int>(300, -1));
	vector< vector<int> > right(n, vector<int>(300, -1));

	for (int i = 0; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			if (left[i][s[j]] == -1) {
				left[i][s[j]] = j;
			}
		}
	}

	for (int i = 1; i < n; ++i) {
		for (int j = i - 1; j >= 0; --j) {
			if (right[i][s[j]] == -1) {
				right[i][s[j]] = j;
			}
		}
	}

	int bestL = 0;
	int bestR = 0;
	for (int length = 1; length <= n; ++length) {
		for (int L = 0; L + length - 1 < n; ++L ) {
			int R = L + length - 1;
			if (L == R) {
				dp[L][R] = 1;
				continue;
			}

			if (s[L] == s[R]) {
				int best = 0;
				for (char ch = 'a'; ch <= 'z'; ++ch) {
					int L1 = left[L][ch];
					int R1 = right[R][ch];
					if (L1 <= R1 && R1 != -1 && L1 != -1) {
						if (dp[L1][R1] > best) {
							best = dp[L1][R1];
						}
					}
				}

				dp[L][R] = best + 2;
				if (dp[L][R] > dp[bestL][bestR]) {
					bestL = L;
					bestR = R;
				}

			}
		}
	}

	string ans;

	int cnt = 0;

	while (dp[bestL][bestR] > 1) {

		ans.push_back(s[bestL]);
		for (char ch = 'a'; ch <= 'z'; ++ch) {
			int L1 = left[bestL][ch];
			int R1 = right[bestR][ch];
			if (L1 <= R1 && R1 != -1 && L1 != -1) {
				if (dp[L1][R1] == dp[bestL][bestR] - 2) {
					bestL = L1;
					bestR = R1;
					break;
				}
			}

		}
	}

	if ((int)ans.size() >= 50) {
		for (int i = 0; i < 50; ++i) {
			cout << ans[i];
		}
		for (int i = 50 - 1; i >= 0; --i) {
			cout << ans[i];
		}
	} else {
		for (int i = 0; i < (int)ans.size(); ++i) {
			cout << ans[i];
		}
		if (dp[bestL][bestR] == 1) {
			cout << s[bestL];
		}
		for (int i = (int)ans.size() - 1; i >= 0; --i) {
			cout << ans[i];
		}
	}

	return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

int dp[3000][3000] = {0};

int main() {
	//freopen("input.txt", "r", stdin);

	string s;
	cin >> s;
	int n = (int)s.size();

	if ((int)s.size() >= 2600) {
		int cnt[300] = {0};
		for (int i = 0; i < (int)s.size(); ++i) {
			++cnt[s[i]];
		}

		for (char ch = 'a'; ch <= 'z'; ++ch) {
			if (cnt[ch] >= 100) {
				for (int i = 0; i < 100; ++i) {
					cout << ch;
				}
				cout << endl;
				return 0;
			}
		}
	}

	vector< vector<int> > left(n, vector<int>(300, -1));
	vector< vector<int> > right(n, vector<int>(300, -1));

	for (int i = 0; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			if (left[i][s[j]] == -1) {
				left[i][s[j]] = j;
			}
		}
	}

	for (int i = 1; i < n; ++i) {
		for (int j = i - 1; j >= 0; --j) {
			if (right[i][s[j]] == -1) {
				right[i][s[j]] = j;
			}
		}
	}

	int bestL = 0;
	int bestR = 0;
	for (int length = 1; length <= n; ++length) {
		for (int L = 0; L + length - 1 < n; ++L ) {
			int R = L + length - 1;
			if (L == R) {
				dp[L][R] = 1;
				continue;
			}

			if (s[L] == s[R]) {
				int best = 0;
				for (char ch = 'a'; ch <= 'z'; ++ch) {
					int L1 = left[L][ch];
					int R1 = right[R][ch];
					if (L1 <= R1 && R1 != -1 && L1 != -1) {
						if (dp[L1][R1] > best) {
							best = dp[L1][R1];
						}
					}
				}

				dp[L][R] = best + 2;
				if (dp[L][R] > dp[bestL][bestR]) {
					bestL = L;
					bestR = R;
				}

			}
		}
	}

	string ans;

	int cnt = 0;

	while (dp[bestL][bestR] > 1) {

		ans.push_back(s[bestL]);
		for (char ch = 'a'; ch <= 'z'; ++ch) {
			int L1 = left[bestL][ch];
			int R1 = right[bestR][ch];
			if (L1 <= R1 && R1 != -1 && L1 != -1) {
				if (dp[L1][R1] == dp[bestL][bestR] - 2) {
					bestL = L1;
					bestR = R1;
					break;
				}
			}

		}
	}

	if ((int)ans.size() >= 50) {
		for (int i = 0; i < 50; ++i) {
			cout << ans[i];
		}
		for (int i = 50 - 1; i >= 0; --i) {
			cout << ans[i];
		}
	} else {
		for (int i = 0; i < (int)ans.size(); ++i) {
			cout << ans[i];
		}
		if (dp[bestL][bestR] == 1) {
			cout << s[bestL];
		}
		for (int i = (int)ans.size() - 1; i >= 0; --i) {
			cout << ans[i];
		}
	}

	return 0;
}


#pragma comment(linker, "/STACK:100000000")
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <ctime>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <list>
#include <deque>

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define taskname "problem_b"

const double pi = acos(-1.0);
const int size = 50 * 1000 + 100;
const int ssize = 102;

int ans[ssize][size];

vector <int> pos[26];
char buf[size];
int n;

int main() {
	/*
	freopen("input.txt", "w", stdout);
	for (int i = 0; i < 50 * 1000; i++)
		cout << 'z';
	cout << endl;
	return 0;
	*/
	//assert(freopen("input.txt", "r", stdin));
	///assert(freopen("output.txt", "w", stdout));

	scanf("%s", buf);
	n = strlen(buf);

	for (int i = 0; i < n; i++) {
		pos[buf[i] - 'a'].pb(i);
	}

	for (int i = 0; i < n; i++) {
		ans[0][i] = -1;
		ans[1][i] = i;
	}

	int mx = 1;
	for (int i = 2; i <= 100; i++) {
		n = n;
		for (int j = 0; j < 26; j++) {
			int mn = n;
			int ph = n - 1;
			int ps = pos[j].size();
			for (int k = (int) pos[j].size() - 1; k >= 0; k--) {
				while (ph > pos[j][k]) {
					mn = min(mn, ans[i - 2][ph]);
					ph--;
				}
				while (ps - 1 > k && pos[j][ps - 1] > mn)
					ps--;
				if (ps != (int) pos[j].size()) {
					mx = i;
					ans[i][pos[j][k]] = pos[j][ps];
				} else {
					ans[i][pos[j][k]] = n;
				}
			}
		}
	}

	int p = -1;
	for (int i = 0; i < n; i++)
		if (ans[mx][i] < n)
			p = i;
	string s;
	while (mx > 1) {
		s += buf[p];
		for (int i = p + 1; i <= ans[mx][p]; i++)
			if (ans[mx - 2][i] < ans[mx][p]) {
				p = i;
				mx -= 2;
				break;
			}
	}
	cout << s;
	if (mx > 0)
		cout << buf[p];
	reverse(s.begin(), s.end());
	cout << s << endl;

	return 0;
}


//          be name khoda

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

const int maxN = 4000;
const int INF = -1;

int dp[maxN][maxN], alpha[100], n;      //dp[l][r] -> mxpss in [l, l+1, ..., r - 1]
string s, out;
char ans;

void chap(int l, int r)
{
    //cerr << l << " " << r << endl;
    if(l >= r)
        return;
    if(l == r - 1)
    {
        out += s[l];
        return;
    }
    /*if(dp[l][r] == 100)
    {
        if(dp[l + 1][r - 1] == 100)
            return chap(l + 1, r - 1);
        if(dp[l + 1][r] == 100)
            return chap(l + 1, r);
        if(dp[l][r - 1] == 100)
            return chap(l, r - 1);
    }*/
    if(s[l] == s[r - 1])
    {
        out += s[l];
        chap(l + 1, r - 1);
        out += s[r - 1];
        return;
    }
    if(dp[l + 1][r] > dp[l][r - 1])
        return chap(l + 1, r);
    return chap(l, r - 1);
}

int solve(int l, int r)
{
    if(l >= r)
        return 0;
    if(l == r - 1)
        return dp[l][r] = 1;
    if(dp[l][r])
        return dp[l][r];
    if(s[l] == s[r - 1])
        return dp[l][r] = solve(l + 1, r - 1) + 2;
    dp[l][r] = max(dp[l][r], max(solve(l + 1, r), solve(l, r - 1)));
    //dp[l][r] = min(dp[l][r], 100);
    return dp[l][r];
}

bool check()
{
    for(int i = 0; i < n; i++)
    {
        alpha[s[i] - 'a']++;
        if(alpha[s[i] - 'a'] >= 100)
        {
            ans = s[i];
            return 1;
        }
    }
    return 0;
}

int main()
{
    cin >> s;
    n = s.size();
    if(check())
    {
        for(int i = 0; i < 100; i++)
            cout << ans;
        cout << endl;
        return 0;
    }//     -> n < ('z' - 'a') * 100
    //for(int i = 0; i < n; i++)
    //  for(int j = 0; j <= n; j++)
    //      dp[i][j] = INF;
    int m = solve(0, n);
    //for(int i = 0; i < n; i++, cout << endl)
    //  for(int j = 0; j <= n; j++)
    //      cout << dp[i][j] << " ";
    //cout << endl;
    //cout << m << endl;
    chap(0, n);
    if(out.size() != m)
        cout << n / (n - n) << endl;
    if(m > 100)
    {
        for(int i = 0; i < 50; i++)
            cout << out[i];
        for(int i = out.size() - 50; i < out.size(); i++)
            cout << out[i];
        cout << endl;
    }
    cout << out << endl;
    cin >> n;
}


//          be name khoda

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

const int maxN = 4000;
const int INF = -1;

int dp[maxN][maxN], alpha[100], n;      //dp[l][r] -> mxpss in [l, l+1, ..., r - 1]
string s;
char ans;

void chap(int l, int r)
{
    //cerr << l << " " << r << endl;
    if(l >= r)
        return;
    if(l == r - 1)
    {
        cout << s[l];
        return;
    }
    if(dp[l][r] == 100)
    {
        if(dp[l + 1][r - 1] == 100)
            return chap(l + 1, r - 1);
        if(dp[l + 1][r] == 100)
            return chap(l + 1, r);
        if(dp[l][r - 1] == 100)
            return chap(l, r - 1);
    }
    if(dp[l][r] == dp[l + 1][r - 1] + 2 && s[l] == s[r - 1])
    {
        cout << s[l];
        chap(l + 1, r - 1);
        cout << s[r - 1];
        return;
    }
    if(dp[l][r] == dp[l + 1][r])
        return chap(l + 1, r);
    return chap(l, r - 1);
}

int solve(int l, int r)
{
    if(l >= r)
        return dp[l][r] = 0;
    if(l == r - 1)
        return dp[l][r] = 1;
    if(dp[l][r] != INF)
        return dp[l][r];
    if(s[l] == s[r - 1])
        dp[l][r] = solve(l + 1, r - 1) + 2;
    dp[l][r] = max(dp[l][r], max(solve(l + 1, r), solve(l, r - 1)));
    dp[l][r] = min(dp[l][r], 100);
    return dp[l][r];
}

bool check()
{
    for(int i = 0; i < n; i++)
    {
        alpha[s[i] - 'a']++;
        if(alpha[s[i] - 'a'] >= 100)
        {
            ans = s[i];
            return 1;
        }
    }
    return 0;
}

int main()
{
    cin >> s;
    n = s.size();
    if(check())
    {
        for(int i = 0; i < 100; i++)
            cout << ans;
        cout << endl;
        return 0;
    }//     -> n < ('z' - 'a') * 100
    for(int i = 0; i < n; i++)
        for(int j = 0; j <= n; j++)
            dp[i][j] = INF;
    int m = solve(0, n), l = 0, r = n;
    //for(int i = 0; i < n; i++, cout << endl)
    //  for(int j = 0; j <= n; j++)
    //      cout << dp[i][j] << " ";
    //cout << endl;
    //cout << m << endl;
    chap(0, n);
    cin >> n;
}


#import<ios>
int n,i;main(){for(scanf("%d",&n);i<n*n;)printf("%d ",i++%(n+1)?0:n);}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 100000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;
const ll MAXN = 1e18;
#define N 100010

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	int n,k;
	cin >> n >> k;
	for(int i=1; i<=n; i++){
		for(int j=0; j<n; j++){
			if(j == i-1){
				cout << k << " ";
			}else{
				cout << 0 << " ";
			}
		}
		cout << endl;
	}
	return 0;
}
//


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 100000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;
const ll MAXN = 1e18;
#define N 100010

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	int n,k;
	cin >> n >> k;
	for(int i=1; i<=n; i++){
		for(int j=0; j<n; j++){
			if(j == i-1){
				cout << 3 << " ";
			}else{
				cout << 0 << " ";
			}
		}
		cout << endl;
	}
	return 0;
}
//


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int a , b;
    cin >> a >> b;
    int c[a+1][a+1];
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<a;j++)
        {
            c[i][j]=0;
        }
    }
    if(b%a!=0)
    {
        for(int i=0;i<a;i++)
        {
            c[i][i]=b;
        }
    }
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<a;j++)
        {
            cout << c[i][j] << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int a , b;
    cin >> a >> b;
    int c[a+1][a+1];
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<a;j++)
        {
            c[i][j]=0;
        }
    }
        for(int i=0;i<a;i++)
        {
            c[i][i]=b;
        }
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<a;j++)
        {
            cout << c[i][j] << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int a , b;
    cin >> a >> b;
    int c[a+1][a+1];
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<a;j++)
        {
            c[i][j]=b/a;
        }
    }
    if(b%a!=0)
    {
        for(int i=0;i<a;i++)
        {
            c[i][i]=b%a+1;
        }
    }
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<a;j++)
        {
            cout << c[i][j] << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int a , b;
    cin >> a >> b;
    int c[a+1][a+1];
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<a;j++)
        {
            c[i][j]=b/a;
        }
    }
    if(b%a!=0)
    {
        for(int i=0;i<a;i++)
        {
            if(b>a)
            {
            c[i][i]=b%a+1;
            }
            else{
                c[i][i]=b%a;
            }
        }
    }
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<a;j++)
        {
            cout << c[i][j] << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int a , b;
    cin >> a >> b;
    int c[a+1][a+1];
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<a;j++)
        {
            c[i][j]=b/a;
        }
    }
    if(b%a!=0)
    {
        for(int i=0;i<a;i++)
        {
            c[i][i]=b%a+1;
        }
    }
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<a;j++)
        {
            cout << c[i][j];
        }
        cout << endl;
    }
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int a , b;
    cin >> a >> b;
    int c[a+1][a+1];
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<a;j++)
        {
            c[i][j]=b/a;
        }
    }
    if(b%a!=0)
    {
        for(int i=0;i<a;i++)
        {
            if(b>a)
            {
            c[i][i]=b%a+1;
            }
            else{
                c[i][j]=b%a;
            }
        }
    }
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<a;j++)
        {
            cout << c[i][j] << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n,k;
    cin >> n >> k;
    int tab[n][n];
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<n;j++)
        {
             if (i==j) tab[i][j]=k;
             else tab[i][j]=0;

        }
    }
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<n;j++)
        {
            cout<< tab[i][j];
        }
        cout<< endl;
    }
    return 0;

}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n,k;
    cin >> n >> k;
    int tab[n][n];
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<n;j++)
        {
             if (i==j) tab[i][j]=k;
             else tab[i][j]=0;

        }
    }
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<n;j++)
        {
            cout<< tab[i][j] <<" ";
        }
        cout<< endl;
    }
    return 0;

}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin >> n;
    cin >> m;
    char tab[n][m];
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<m;j++)
        {
            cin >> tab[i][j];
        }
    }
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<m;j++)
        {
            if (tab[i][j]=='.')
            {
                if ((i+j)%2) tab[i][j]='W';
                else tab[i][j]='B';
            }
        }
    }
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<m;j++)
        {
            cout<< tab[i][j];
        }
        cout<< endl;
    }
    return 0;

}


#include <bits/stdc++.h>

using namespace std;
int main() {
    int n, k, t, sum;
    cin>>n>>k;
    sum = k;
    t = k;
    k = k%1000;
    int column[n]={0}, row[n]={0};
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if(column[j]+1000 <= sum && row[i]+1000 <= sum){
                column[j]+=1000;
                row[i]+=1000;
                cout<<1000;
            }
            else if(column[j]+k<=sum && row[i]+k<=sum){
                column[j]+=k;
                row[i]+=k;
                cout<<k;
            }
            else cout<<0;
            cout<<" ";
        }
        cout<<endl;
    }
}


#include <bits/stdc++.h>

using namespace std;
int main() {
    int n, k;
    cin>>n>>k;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if(i==j) cout<<k;
            else cout<<0;
            cout<<" ";
        }
        cout<<endl;
    }
}


#include <bits/stdc++.h>

using namespace std;
int main() {
    int n, k;
    cin>>n>>k;
    for (int i = 0; i < n; ++i) {
        int t=k;
        for (int j = 0; j < n; ++j) {
            int mn = min(1000, t);
            t-=mn;
            cout<<mn<<" ";
        }
        cout<<endl;
    }
}


#include <bits/stdc++.h>
#include <utility>
using namespace std;

#define fore(i, init, n) for(int i = init; i < n; i++)
#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb(a) push_back(a)
#define INF (1LL<<50)
#define ll long long
#define snd second
#define fst first
#define endl "\n"
#define SZ(a)  (int)a.size()

ll n,m,k,a[101][101];

int main(){
    cin>>n>>k;
    fore(i,0,n){
        fore(j,0,n){
            if(j == i)cout<<k<<" ";
            else cout<<0<<" ";
        }
        cout<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#include <utility>
using namespace std;

#define fore(i, init, n) for(int i = init; i < n; i++)
#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb(a) push_back(a)
#define INF (1LL<<50)
#define ll long long
#define snd second
#define fst first
#define endl "\n"
#define SZ(a)  (int)a.size()

ll n,m,k;
int main(){
    cin>>n>>k;
    fore(i,0,n){
        fore(j,0,n){
            if(j < n-1)cout<<k/n<<" ";
            else cout<<k/n + k%n<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#include <utility>
using namespace std;

#define fore(i, init, n) for(int i = init; i < n; i++)
#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb(a) push_back(a)
#define INF (1LL<<50)
#define ll long long
#define snd second
#define fst first
#define endl "\n"
#define SZ(a)  (int)a.size()

ll n,m,k,a[101][101];

int main(){
    cin>>n>>k;
    fore(i,0,n){
        fore(j,0,n){
            if(j < n-1)a[i][j] = k/n;
            else a[i][j] = k/n + k%n;
        }
    }
    fore(j,0,n){
        fore(i,0,n){
            cout<<a[i][j]<<" ";
        }
        cout<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>

/// Constants
#define INF				    1e9+7
#define eps                 1e-9
#define PI                  acos(-1.0)  // 3.1415926535897932

#define Loser ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define GCD(a,b) __gcd(a,b)
#define LCM(a,b) (a*(b/__gcd(a,b) ))
#define mp make_pair
#define pb push_back

#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<ll>())
#define hellyeah exit(0)
#define file freopen("input.txt","r",stdin);
#define check printf("Avenger's Assemble");
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

ll revNumber(ll n) { ll b=0; while(n!=0){ b = b*10 + n%10; n/=10; } return b; }

ll leapYearCheck(ll year) { if(year%4!=0) return 0; else if(year%100!=0) return 1; else if(year%400!=0) return 0; else return 1; }

ll countDivisor(ll n) { ll ck=0; for(ll i=1; i*i<=n; i++){ if(n%i==0){ ck++; if(i!=n/i) ck++; } } return ck; }

ll primeFactorsCount(ll n){ ll gf =0;  while (n%2 == 0) { gf++; n = n/2; } for (ll i = 3; i <= sqrt(n); i = i+2) { while (n%i == 0) { gf++;  n = n/i; } } if (n > 2){ gf++; } return gf; }

ll factorial(ll n) { if(n == 1) return 1; return n*factorial(n-1); }

ll binarySearch(ll high, ll sV, ll arr[]) { ll low = 0; while(low<=high){ ll mid = (high+low)/2; if(sV == arr[mid]) return mid+1; else if(sV > arr[mid]) low = mid+1; else high = mid-1; } return -1; }

bool checkPrime(int n) { int i; if(n<=1)return false; for(i=2;i*i<=n;i++){ if(n%i==0)return false; } return true; }

void simpleSieve(int limit){bool mark[limit];memset(mark,true,sizeof(mark));for(int p=2;p*p<limit;++p){if(mark[p]==true){for(int i=p*2;i<limit;i+=p)mark[i]=false;}}for(int p=2;p<limit;++p){if(mark[p]==true)cout<<p<<" ";}}

int divSum(int n){int result=0;for(int i=2;i<=sqrt(n);++i){if(n%i==0){if(i==(n/i))result+=i;else result+=(i+n/i);}}return (result+1);}

bool isPerfectSquare(int n){for(int sum=0,i=1;sum<n;i+=2){sum+=i;if(sum==n)return true;}return false;}

bool isPowerOfTwo(ll x){return (x && !(x & (x - 1)));}

bool checksqrt(double f){return (sqrt(f)*sqrt(f)==f);}

//string  makeitstring(ll n){string ans;bool ch=0;if (n<0){n*=-1;ch=1;}if (n==0){ans="0";};while (n){ll mod=n%10;mod+=48;char m=mod;ans=m+ans;n/=10;}if (ch){ans='-'+ans;}return ans;}

//ll makeitnumber(string s){ll ans=0;for (ll i=0; i<s.size(); i++){if(s[i]!='-'){ll num=s[i]-'0';ans+=(num*fastpower(10,(ll)s.size()-i-1));}}if(s[0]=='-'){return ans*-1;}else {return ans;}}

int Combination(int n,int r){if(n==r)return 1;if(r==1)return n;return Combination(n-1,r)+Combination(n-1,r-1);}

int Permutation(int n,int r){return factorial(n)/factorial(n-r);}

int middle(int a, int b, int c) { if ((a <= b && b <= c) || (c <= b && b <= a)) return b;else if ((b <= a && a <= c) || (c <= a && a <= b))return a;else return c; }

/*max element in map*/
template<typename KeyType, typename ValueType>
std::pair<KeyType,ValueType> get_max( const std::map<KeyType,ValueType>& x ) {
  using pairtype=std::pair<KeyType,ValueType>;
  return *std::max_element(x.begin(), x.end(), [] (const pairtype & p1, const pairtype & p2) {
        return p1.second < p2.second;//min->p1.second>p2.second
  });
  //auto max=get_max(x);
//std::cout << max.first << "=>" << max.second << std::endl;

//set->max:m=*a.rbegin();min:mi=*a.begin();

}
static inline bool isvowel(char ch)
{
        static const std::string vowels("aeiouEAIOU");
        return vowels.end() != std::find(vowels.begin(), vowels.end(), ch);
}

/*------------------------------------------------------------------------------------------------------------------------------------------------------*/

int main()
{
	Loser
	int n,k;cin>>n>>k;
	vector<vector<int>>v(n,vector<int>(n));
	char ch=n-k+1;
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<n;++j)
		{
			if(i==j)v[i][j]=abs(k-n)+1;
			else v[i][j]=1;
		}
	}
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<n;++j)
		{
			cout<<v[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>

/// Constants
#define INF				    1e9+7
#define eps                 1e-9
#define PI                  acos(-1.0)  // 3.1415926535897932

#define Loser ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define GCD(a,b) __gcd(a,b)
#define LCM(a,b) (a*(b/__gcd(a,b) ))
#define mp make_pair
#define pb push_back

#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<ll>())
#define hellyeah exit(0)
#define file freopen("input.txt","r",stdin);
#define check printf("Avenger's Assemble");
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

ll revNumber(ll n) { ll b=0; while(n!=0){ b = b*10 + n%10; n/=10; } return b; }

ll leapYearCheck(ll year) { if(year%4!=0) return 0; else if(year%100!=0) return 1; else if(year%400!=0) return 0; else return 1; }

ll countDivisor(ll n) { ll ck=0; for(ll i=1; i*i<=n; i++){ if(n%i==0){ ck++; if(i!=n/i) ck++; } } return ck; }

ll primeFactorsCount(ll n){ ll gf =0;  while (n%2 == 0) { gf++; n = n/2; } for (ll i = 3; i <= sqrt(n); i = i+2) { while (n%i == 0) { gf++;  n = n/i; } } if (n > 2){ gf++; } return gf; }

ll factorial(ll n) { if(n == 1) return 1; return n*factorial(n-1); }

ll binarySearch(ll high, ll sV, ll arr[]) { ll low = 0; while(low<=high){ ll mid = (high+low)/2; if(sV == arr[mid]) return mid+1; else if(sV > arr[mid]) low = mid+1; else high = mid-1; } return -1; }

bool checkPrime(int n) { int i; if(n<=1)return false; for(i=2;i*i<=n;i++){ if(n%i==0)return false; } return true; }

void simpleSieve(int limit){bool mark[limit];memset(mark,true,sizeof(mark));for(int p=2;p*p<limit;++p){if(mark[p]==true){for(int i=p*2;i<limit;i+=p)mark[i]=false;}}for(int p=2;p<limit;++p){if(mark[p]==true)cout<<p<<" ";}}

int divSum(int n){int result=0;for(int i=2;i<=sqrt(n);++i){if(n%i==0){if(i==(n/i))result+=i;else result+=(i+n/i);}}return (result+1);}

bool isPerfectSquare(int n){for(int sum=0,i=1;sum<n;i+=2){sum+=i;if(sum==n)return true;}return false;}

bool isPowerOfTwo(ll x){return (x && !(x & (x - 1)));}

bool checksqrt(double f){return (sqrt(f)*sqrt(f)==f);}

//string  makeitstring(ll n){string ans;bool ch=0;if (n<0){n*=-1;ch=1;}if (n==0){ans="0";};while (n){ll mod=n%10;mod+=48;char m=mod;ans=m+ans;n/=10;}if (ch){ans='-'+ans;}return ans;}

//ll makeitnumber(string s){ll ans=0;for (ll i=0; i<s.size(); i++){if(s[i]!='-'){ll num=s[i]-'0';ans+=(num*fastpower(10,(ll)s.size()-i-1));}}if(s[0]=='-'){return ans*-1;}else {return ans;}}

int Combination(int n,int r){if(n==r)return 1;if(r==1)return n;return Combination(n-1,r)+Combination(n-1,r-1);}

int Permutation(int n,int r){return factorial(n)/factorial(n-r);}

int middle(int a, int b, int c) { if ((a <= b && b <= c) || (c <= b && b <= a)) return b;else if ((b <= a && a <= c) || (c <= a && a <= b))return a;else return c; }

/*max element in map*/
template<typename KeyType, typename ValueType>
std::pair<KeyType,ValueType> get_max( const std::map<KeyType,ValueType>& x ) {
  using pairtype=std::pair<KeyType,ValueType>;
  return *std::max_element(x.begin(), x.end(), [] (const pairtype & p1, const pairtype & p2) {
        return p1.second < p2.second;//min->p1.second>p2.second
  });
  //auto max=get_max(x);
//std::cout << max.first << "=>" << max.second << std::endl;

//set->max:m=*a.rbegin();min:mi=*a.begin();

}
static inline bool isvowel(char ch)
{
        static const std::string vowels("aeiouEAIOU");
        return vowels.end() != std::find(vowels.begin(), vowels.end(), ch);
}

/*------------------------------------------------------------------------------------------------------------------------------------------------------*/

int main()
{
	Loser
	int n,k;cin>>n>>k;
	vector<vector<int>>v(n,vector<int>(n));
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<n;++j)
		{
			if(n<=k)
			{
				if(i==j)v[i][j]=abs(k-n)+1;
				else v[i][j]=1;
			}
			else
			{
				if(i==j)v[i][j]=k;
				else v[i][j]=0;
			}

		}
	}
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<n;++j)
		{
			cout<<v[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>

/// Constants
#define INF				    1e9+7
#define eps                 1e-9
#define PI                  acos(-1.0)  // 3.1415926535897932

#define Loser ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define GCD(a,b) __gcd(a,b)
#define LCM(a,b) (a*(b/__gcd(a,b) ))
#define mp make_pair
#define pb push_back

#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<ll>())
#define hellyeah exit(0)
#define file freopen("input.txt","r",stdin);
#define check printf("Avenger's Assemble");
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

ll revNumber(ll n) { ll b=0; while(n!=0){ b = b*10 + n%10; n/=10; } return b; }

ll leapYearCheck(ll year) { if(year%4!=0) return 0; else if(year%100!=0) return 1; else if(year%400!=0) return 0; else return 1; }

ll countDivisor(ll n) { ll ck=0; for(ll i=1; i*i<=n; i++){ if(n%i==0){ ck++; if(i!=n/i) ck++; } } return ck; }

ll primeFactorsCount(ll n){ ll gf =0;  while (n%2 == 0) { gf++; n = n/2; } for (ll i = 3; i <= sqrt(n); i = i+2) { while (n%i == 0) { gf++;  n = n/i; } } if (n > 2){ gf++; } return gf; }

ll factorial(ll n) { if(n == 1) return 1; return n*factorial(n-1); }

ll binarySearch(ll high, ll sV, ll arr[]) { ll low = 0; while(low<=high){ ll mid = (high+low)/2; if(sV == arr[mid]) return mid+1; else if(sV > arr[mid]) low = mid+1; else high = mid-1; } return -1; }

bool checkPrime(int n) { int i; if(n<=1)return false; for(i=2;i*i<=n;i++){ if(n%i==0)return false; } return true; }

void simpleSieve(int limit){bool mark[limit];memset(mark,true,sizeof(mark));for(int p=2;p*p<limit;++p){if(mark[p]==true){for(int i=p*2;i<limit;i+=p)mark[i]=false;}}for(int p=2;p<limit;++p){if(mark[p]==true)cout<<p<<" ";}}

int divSum(int n){int result=0;for(int i=2;i<=sqrt(n);++i){if(n%i==0){if(i==(n/i))result+=i;else result+=(i+n/i);}}return (result+1);}

bool isPerfectSquare(int n){for(int sum=0,i=1;sum<n;i+=2){sum+=i;if(sum==n)return true;}return false;}

bool isPowerOfTwo(ll x){return (x && !(x & (x - 1)));}

bool checksqrt(double f){return (sqrt(f)*sqrt(f)==f);}

//string  makeitstring(ll n){string ans;bool ch=0;if (n<0){n*=-1;ch=1;}if (n==0){ans="0";};while (n){ll mod=n%10;mod+=48;char m=mod;ans=m+ans;n/=10;}if (ch){ans='-'+ans;}return ans;}

//ll makeitnumber(string s){ll ans=0;for (ll i=0; i<s.size(); i++){if(s[i]!='-'){ll num=s[i]-'0';ans+=(num*fastpower(10,(ll)s.size()-i-1));}}if(s[0]=='-'){return ans*-1;}else {return ans;}}

int Combination(int n,int r){if(n==r)return 1;if(r==1)return n;return Combination(n-1,r)+Combination(n-1,r-1);}

int Permutation(int n,int r){return factorial(n)/factorial(n-r);}

int middle(int a, int b, int c) { if ((a <= b && b <= c) || (c <= b && b <= a)) return b;else if ((b <= a && a <= c) || (c <= a && a <= b))return a;else return c; }

/*max element in map*/
template<typename KeyType, typename ValueType>
std::pair<KeyType,ValueType> get_max( const std::map<KeyType,ValueType>& x ) {
  using pairtype=std::pair<KeyType,ValueType>;
  return *std::max_element(x.begin(), x.end(), [] (const pairtype & p1, const pairtype & p2) {
        return p1.second < p2.second;//min->p1.second>p2.second
  });
  //auto max=get_max(x);
//std::cout << max.first << "=>" << max.second << std::endl;

//set->max:m=*a.rbegin();min:mi=*a.begin();

}
static inline bool isvowel(char ch)
{
        static const std::string vowels("aeiouEAIOU");
        return vowels.end() != std::find(vowels.begin(), vowels.end(), ch);
}

/*------------------------------------------------------------------------------------------------------------------------------------------------------*/

int main()
{
	Loser
	int n,k;cin>>n>>k;
	vector<vector<int>>v(n,vector<int>(n));
	char ch=n-k+1;
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<n;++j)
		{
			if(j==0)v[i][j]=abs(k-n)+1;
			else v[i][j]=1;
		}
	}
	for(int i=0;i<n;++i)
	{
		for(int j=0;j<n;++j)
		{
			cout<<v[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}


#pragma GCC optimize(2)
#pragma GCC optimize(3)
 #include<bits/stdc++.h>
 #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
  using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define fort while(t--)
#define ld long double
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define vd vector<double>
#define vi vector<int>
#define pd pair<double,double>
#define vc vector<char>
#define vs vector<string>
#define pi pair<int,int>
#define pl pair<ll,ll>
#define ull unsigned long long int
const ll mod= 1e9+7;

template <class nmsl> inline void read(nmsl &x)
{
	x=0;
	char ch=getchar(), w=0;
	while(!isdigit(ch))w=(ch=='-'), ch=getchar();
	while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48), ch=getchar();
	x=w?-x:x;
}

ll power(ll x,ll y,ll z){
	x=(x%z);
	ll res=1LL;
	while(y>0){
		if(y&1){
			res=(res*x)%z;
		}
		x=(x*x)%z;
		y=y>>1;
	}
	return res;
}

ll modInv(ll n, ll mod)
{
    return power(n, mod-2, mod);
}
ll nCrModP(ll n, ll r, ll mod)
{
   if (r==0)
      return 1;
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%mod;

    return (fac[n]* modInv(fac[r], mod) % mod *modInv(fac[n-r], mod) % mod) % mod;
}

ll countSetBits(ll n)
{
    ll count = 0;
    while (n)
    {
    n &= (n-1) ;
    count++;
    }
    return count;
}

int main() {
	#ifndef ONLINE_JUDGE
	//for getting input from input.txt
	freopen("input2.txt","r",stdin);
	//for writing output to output.txt
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,k;
	cin>>n>>k;
	int s=((n-1)*n)/2;
	vector<int> v;
	for(int i=1;i<n;i++)
		v.pb(i);
	int factor=k/s;
	if(factor>0)
	{
		for(int j=0;j<n;j++)
		{
			v[j]*=factor;
		}
	}
	int rem=k%(factor*s);
	v.pb(rem);
	sort(v.begin(),v.end());
	int kd=-1;
	for(int i=0;i<n;i++)
	{
		kd++;
		for(int j=0;j<n;j++)
		{
			cout<<v[(kd+j)%n]<<" ";
		}
		cout<<endl;
	}
	return 0;
}


#pragma GCC optimize(2)
#pragma GCC optimize(3)
 #include<bits/stdc++.h>
 #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
  using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define fort while(t--)
#define ld long double
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define vd vector<double>
#define vi vector<int>
#define pd pair<double,double>
#define vc vector<char>
#define vs vector<string>
#define pi pair<int,int>
#define pl pair<ll,ll>
#define ull unsigned long long int
const ll mod= 1e9+7;

template <class nmsl> inline void read(nmsl &x)
{
	x=0;
	char ch=getchar(), w=0;
	while(!isdigit(ch))w=(ch=='-'), ch=getchar();
	while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48), ch=getchar();
	x=w?-x:x;
}

ll power(ll x,ll y,ll z){
	x=(x%z);
	ll res=1LL;
	while(y>0){
		if(y&1){
			res=(res*x)%z;
		}
		x=(x*x)%z;
		y=y>>1;
	}
	return res;
}

ll modInv(ll n, ll mod)
{
    return power(n, mod-2, mod);
}
ll nCrModP(ll n, ll r, ll mod)
{
   if (r==0)
      return 1;
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%mod;

    return (fac[n]* modInv(fac[r], mod) % mod *modInv(fac[n-r], mod) % mod) % mod;
}

ll countSetBits(ll n)
{
    ll count = 0;
    while (n)
    {
    n &= (n-1) ;
    count++;
    }
    return count;
}

int main() {
	#ifndef ONLINE_JUDGE
	//for getting input from input.txt
	freopen("input2.txt","r",stdin);
	//for writing output to output.txt
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,k;
	cin>>n>>k;
	if(n==1)
	{
		cout<<k<<endl;
		return 0;
	}
	int s=((n-1)*n)/2;
	vector<int> v;
	for(int i=1;i<n;i++)
		v.pb(i);
	int factor=k/s;
	if(factor>0)
	{
		for(int j=0;j<n;j++)
		{
			v[j]*=factor;
		}
	}
	int rem=k%(factor*s);
	v.pb(rem);
	sort(v.begin(),v.end());
	int kd=-1;
	for(int i=0;i<n;i++)
	{
		kd++;
		for(int j=0;j<n;j++)
		{
			cout<<v[(kd+j)%n]<<" ";
		}
		cout<<endl;
	}
	return 0;
}


#pragma GCC optimize(2)
#pragma GCC optimize(3)
 #include<bits/stdc++.h>
 #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
  using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define fort while(t--)
#define ld long double
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define vd vector<double>
#define vi vector<int>
#define pd pair<double,double>
#define vc vector<char>
#define vs vector<string>
#define pi pair<int,int>
#define pl pair<ll,ll>
#define ull unsigned long long int
const ll mod= 1e9+7;

template <class nmsl> inline void read(nmsl &x)
{
	x=0;
	char ch=getchar(), w=0;
	while(!isdigit(ch))w=(ch=='-'), ch=getchar();
	while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48), ch=getchar();
	x=w?-x:x;
}

ll power(ll x,ll y,ll z){
	x=(x%z);
	ll res=1LL;
	while(y>0){
		if(y&1){
			res=(res*x)%z;
		}
		x=(x*x)%z;
		y=y>>1;
	}
	return res;
}

ll modInv(ll n, ll mod)
{
    return power(n, mod-2, mod);
}
ll nCrModP(ll n, ll r, ll mod)
{
   if (r==0)
      return 1;
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%mod;

    return (fac[n]* modInv(fac[r], mod) % mod *modInv(fac[n-r], mod) % mod) % mod;
}

ll countSetBits(ll n)
{
    ll count = 0;
    while (n)
    {
    n &= (n-1) ;
    count++;
    }
    return count;
}

int main() {
	#ifndef ONLINE_JUDGE
	//for getting input from input.txt
	freopen("input2.txt","r",stdin);
	//for writing output to output.txt
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,k;
	cin>>n>>k;
	if(n==1)
	{
		cout<<k<<endl;
		return 0;
	}
	if(n>k)
	{
		vector<int> vt{k};
		for(int i=0;i<n-1;i++)
			vt.pb(0);
		int kd=-1;
		for(int i=0;i<n;i++)
		{
			kd++;
			for(int j=0;j<n;j++)
			{
				cout<<vt[(kd+j)%n]<<" ";
			}
			cout<<endl;
		}
		return 0;
	}
	int s=((n-1)*n)/2;
	vector<int> v;
	for(int i=1;i<n;i++)
		v.pb(i);
	int factor=k/s;
	if(factor>0)
	{
		for(int j=0;j<n;j++)
		{
			v[j]*=factor;
		}
	}
	int rem=k%(factor*s);
	v.pb(rem);
	sort(v.begin(),v.end());
	int kd=-1;
	for(int i=0;i<n;i++)
	{
		kd++;
		for(int j=0;j<n;j++)
		{
			cout<<v[(kd+j)%n]<<" ";
		}
		cout<<endl;
	}
	return 0;
}