This problem's actual name, "Lexicographically Largest Palindromic Subsequence" is too long to fit into the page headline.You are given string s consisting of lowercase English letters only. Find its lexicographically largest palindromic subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk (1  ≤  p1 < p2 < ... < pk  ≤  |s|) a subsequence of string s = s1s2... s|s|, where |s| is the length of string s. For example, strings "abcb", "b" and "abacaba" are subsequences of string "abacaba".String x = x1x2... x|x| is lexicographically larger than string y = y1y2... y|y| if either |x| > |y| and x1 = y1, x2 = y2, ..., x|y| = y|y|, or there exists such number r (r < |x|, r < |y|) that x1 = y1, x2 = y2, ..., xr = yr and xr  +  1 > yr  +  1. Characters in the strings are compared according to their ASCII codes. For example, string "ranger" is lexicographically larger than string "racecar" and string "poster" is lexicographically larger than string "post".String s = s1s2... s|s| is a palindrome if it matches string rev(s) = s|s|s|s| - 1... s1. In other words, a string is a palindrome if it reads the same way from left to right and from right to left. For example, palindromic strings are "racecar", "refer" and "z".

The only input line contains a non-empty string s consisting of lowercase English letters only. Its length does not exceed 10.

Print the lexicographically largest palindromic subsequence of string s.

NoteAmong all distinct subsequences of string "radar" the following ones are palindromes: "a", "d", "r", "aa", "rr", "ada", "rar", "rdr", "raar" and "radar". The lexicographically largest of them is "rr".

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <tuple>
#include <map>
#include <set>

#pragma comment(

using namespace std;

#define ll long long
#define loop( i, b, e ) for ( auto i = b; i != e; i++ )
#define mt make_tuple
#define mp make_pair

unsigned char conv( unsigned char a )
{
	unsigned char m = 0;

	for ( int j = 0; j < 8; j++ )
	{
		m = m << 1;
		m |= ( a & 1 );
		a = a >> 1;
	}

	return m;
}

void program()
{
	string s;

	getline( cin, s );

	char mx = 0;
	ll cnt = 0;

	for ( ll i = 0; i < s.length(); i++ )
	{
		if ( s[i] > mx )
		{
			cnt = 1;
			mx = s[i];
			continue;
		}

		if ( s[i] == mx )
		{
			cnt++;
		}
	}

	for ( int i = 0; i < cnt; i++ )
	{
		cout << mx;
	}

	return;
}

//=====================================================

int main()
{
	cin.sync_with_stdio( false );
	cout.sync_with_stdio( false );

	bool first = true;

	while ( cin && !cin.eof() )
	{
		if ( first )
			first = false;
		else
			cout << endl << endl;

		program();

		cin >> ws;
	}

	return 0;
}

#include <bits/stdc++.h>
int32_t main()
{
    char a = 'a', e;
    int b = 0;
    while (std::cin >> e)
    if (e >= a) e > a ? a = e, b = 1 : b++;
    while (b--) std::cout << a;
}

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

using namespace std;

int main(){
    string s;
    cin >> s;

    int L = s.size();

    string ans;

    for(int mask = 1;mask < (1 << L);++mask){
        string aux;

        for(int i = 0;i < L;++i)
            if(mask >> i & 1)
                aux += s[i];

        string aux2 = aux;
        reverse(aux2.begin(),aux2.end());

        if(aux == aux2)
            ans = max(ans,aux);
    }

    cout << ans << '\n';

    return 0;
}

//ÈÓã Çááå ÇáÑÍãä ÇáÑÍíã//
#include <bits/stdc++.h>

using namespace std;

int main()
{
	string s;
	char t[1000];
	cin >> s;

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

	sort(t, t+s.size());

	for(int i = 0; i<s.size(); i++)
	{
		if(s[i] == t[s.size()-1])
		{
			cout << s[i];
		}
	}

	return 0;
}

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

typedef long long ll; ///NOTES:int64
typedef vector<int> vi;

const double eps = 1e-11; ///NOTES:eps
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const double pi = acos(-1.0); ///NOTES:pi
const int MAX = 1000000000 ; /// 10^9

#define SZ(x)           (int)x.size()
#define ALL(x)          (x).begin(),(x).end()
#define ALLR(x)         (x).rbegin(),(x).rend()
#define PB( x )         push_back(x)
#define MP(x , y)           make_pair(x,y)
#define rep(i,st,en) for(int i=st ; i< en; i++)
#define repR(i,st,en) for(int i=st;i>=en ; i--)

class
Over9000Rocks
{
public :

int countPossibilities(vector <int> lowerBound, vector <int> upperBound)
{

return 0;
}
};

int main()
{
 /// freopen("input.txt" , "rt",stdin);
///  freopen("output.txt", "wt", stdout);

string s ;
cin >> s ;

vector<string>all  , res ;

for(int i=0 ; i<SZ(s) ; i++)
{

    char ch = s[i];

    rep(j,0,SZ(all))
    {

        res.PB( all[j]+ch);
    }
    string k = "";
    res.PB( k+ch);
    all = res ;
}

sort(ALL(res));

repR(i,SZ(res)-1 , 0)
{
    string s2 = res[i];
    reverse(ALL(s2));
    if(s2 == res[i])
    {
        cout << s2 << endl ;
        return 0;
    }
}

///-----------------
return 0;
}

#include <set>
#include <map>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

std::string s;
bool check(std::string &s) {
	for (int i = 0, j = s.size() - 1; i < j; ++i, --j)
		if (s[i] != s[j]) return false;
	return true;
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
#endif
	std::cin >> s;
	std::string ans = "";
	for (int i = 1; i < (1 << s.size()); ++i) {
		std::string t = "";
		for (int j = 0; j < s.size(); ++j)
			if (i & (1 << j))
				t += s[j];
		if (check(t) && ans < t)
			ans = t;
	}
	std::cout << ans << std::endl;
	return 0;
}

// 202A
// Lexicographically Largest Palindromic Subsequence

#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
using  namespace std;

int main()
{
   char s[1000];
   char count[1000] = {0};
   int m = -1;
   scanf("%s", s);
   for(int i = 0; i < strlen(s); i++) {
    count[s[i]]++;
    if(s[i] > m) m = s[i];
   }
   for(int i = 0; i < count[m]; i++) putchar(m);

}

#include <stdio.h>
char m, c, cnt;
main () {
 while (scanf("%c", &c)>=1) {
  if (c>m) m = c, cnt = 0;
  if (c>=m) cnt++;
 }
 c=0;
 while (c++!=cnt)
 printf("%c",m);
}

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

std::string toString(const std::string& str,std::vector<int> indeces)
{
	std::string answer;
	for(int i = 0;i < indeces.size();i++)
		answer.push_back(str[indeces[i]]);
	return answer;
}

bool isPalindrom(const std::string& p)
{
	for(int i = 0;i < p.size()/2;i++)
		if(p[i] != p[p.size()-i-1])
			return false;
	return true;
}

void p(const std::string& str,std::vector<int>& indeces,std::set<std::string>& palindroms,int current_index)
{

	if(isPalindrom(toString(str,indeces)))
		palindroms.insert(toString(str,indeces));
	for(int i = current_index + 1;i < str.size();i++)
	{
		indeces.push_back(i);
		p(str,indeces,palindroms,i);
		indeces.pop_back();
	}
}

int main()
{
	std::string str;
	std::cin >> str;
	std::set<std::string> palindroms;
	p(str,std::vector<int>(),palindroms,-1);
	std::cout << *--std::set<std::string>::iterator(palindroms.end())<<std::endl;

}

#include<bits/stdc++.h>
using namespace std;
set<string>st;
string s,ans;
bool ok(string t)
{
	string r=t;
	reverse(r.begin(),r.end());
	return (t==r);
}
void dfs(string t,int now)
{
	if(now==s.size())return;
	for(int i=now;i<s.size();i++)
	{
		string add=t+s[i];
		dfs(add,i+1);
		if(ok(add))
			st.insert(add);
	}
}
int main()
{
	cin>>s;
	dfs("",0);
	for(set<string>::iterator it=st.begin();it!=st.end();it++)
		ans=*it;
	cout<<ans<<endl;
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    int n = 0;
    sort(s.begin(), s.end());
    for(int i = 0;i < s.size();i++)
        if(s[i] == s[s.size() - 1])
            cout << s[i];
    return 0;
}

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

int main()
{
    string s;
    cin>>s;

    int len=s.size();

    long int range=(1<<len)-1;
    string ans;

    for(int i=0;i<=range;i++)
    {
        int a=i;
        string temp;
        int pos=0;
        while(a>0)
        {
            if((a&1)!=0)
            {
                temp.push_back(s[pos]);
            }
            pos++;
            a=a>>1;

        }
        string temp1=temp;
        reverse(temp.begin(),temp.end());
        int x=temp.compare(temp1);
        if(x==0)
        {
           if(temp>ans)
           {
               ans=temp;
           }
        }
    }

    cout<<ans<<endl;
}

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

int main(){
    string s;
    cin>>s;
    sort(s.begin(),s.end(),greater<char>());

    for(int i=0;i<s.length();i++){
        if(s[i]==s[0])
            cout<<s[i];
    }

}

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <iostream>
#include <string.h>
#include <set>
#include <queue>
#include <complex>
#include <deque>
#include <map>
using namespace std;
#define LL int64_t // 64-bit long long int, use %I64d for scan and printf

int DEBUG = 0;
main(int argc, char **argv) {
  DEBUG = (argc>=2) ? atoi(argv[1]) : 0;
  char str[20];
  cin >> str;
  //cout << str << endl;
  char max = 'a';
  int k = 0;

  for(int i = 0; i < strlen(str); i++){
    if(str[i] == max){
      k++;
    } else if(str[i] > max){
      max = str[i];
      k = 1;
    }
  }
  for(int i = 0; i < k; i++){
    cout << max;
  }
  cout << endl;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,a[26]={0},x,y,z;
    char s[11],p;
    cin>>s;
    x=strlen(s);
    for(i=0;i<x;i++)
    {
        y=s[i];
        a[y-97]++;
    }
    x=0;i=25;
    z=a[i];
    while(z==0)
    {
        i--;
        z=a[i];

    }
    p=97+i;
    for(i=0;i<z;i++)
        cout<<p;
    return 0;
}

#include <iostream>

using namespace std;

int main() {
    int alph[26] = {0};
    string s;
    cin >> s;
    for(int i = 0; i < s.length(); i++) {
        alph[s[i] - 'a']++;
    }
    for(int i = 25; i >= 0; i--) {
        if(alph[i] > 0) {
            while(alph[i]--) {
                cout << char(i + 'a');
            }
            cout << endl;
            return 0;
        }
    }
    return 0;
}

#include <iostream>
#include <math.h>
#include <cstring>
#include <string>
#include <stdio.h>
#include <algorithm>    // std::sort
#include <cctype>
#include <sstream>
#include <vector>
#include <map>
#include <fstream>
//#include <pair>
#include <set>
#include <iomanip>
#include <fstream>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int i = s.length()-1;
    short f[26];
    memset(f,0,sizeof(short)*26);
    char maxC = 'a'-1;
    while(i >=0)
    {
    f[s[i]-'a']++;
    if(s[i]  > maxC)
        maxC = s[i];
    --i;
    }
    for(i = 0; i < f[maxC-'a'];++i)
        cout << maxC;

return 0;

    }

#include<bits/stdc++.h>
using namespace std;
int main()
{

		string x;
		cin>>x;
		string a,y;
		y=x;
		sort(y.begin(),y.end());
		int len=x.length();
		char aa=y[len-1];
		for(int i=0;i<len;i++)
		{
			if(aa==x[i])
			a+=x[i];
		}
		cout<<a<<endl;

	}

#include<bits/stdc++.h>
#include<iostream>

using namespace std;
typedef long long ll;
string s,ans="",ss="";
void bc(int i)
{
    if(ss==s)
        return;
    string str=ss;
    reverse(str.begin(),str.end());
    if(str==ss)
        ans=max(ss,ans);
    if(i>=s.size())
        return ;
        for(int j=i;j<s.size();j++)
        {
            ss.push_back(s[i]);
            bc(j+1);
            ss.erase(ss.size()-1,1);
        }
}
class run
{
    public:
    run()
    {
        cin>>s;
        ans.push_back(*max_element(s.begin(),s.end()));
        int i=count(s.begin(),s.end(),(*max_element(s.begin(),s.end())));
        while(i--)
            cout<<ans;
    }
    private:
    string s,ans="";

};
int main()
{
    run();
    return 0;
}

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

#define what_is(x)    cerr<<#x<<" is "<<x<<"\n";
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,ans; string str;
bool comp(string s1,string s2){
    if(s1.length()>s2.length()) return s1>s2;
    else return s1<s2;
}
int solve(){
    cin>>str;
    n=str.length();
    vector<string> v;
    for (int i = 0; i < (1<<n); ++i)
    {
        string s="";
        for (int j = 0; j < n; ++j)
        {
            if(i&(1<<j)) s.append(str.begin()+j,str.begin()+j+1);
        }
        string t=s;
        reverse(all(t));
        if(t==s) v.pb(s);
    }
    sort(all(v));
    cout<<v[v.size()-1];
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main () {
  string s; cin >> s;
  vector<int> a(26);
  for (auto c : s) {
    a[c - 'a']++;
  }
  for (int i = 25; i >= 0; i--) {
    if (a[i]) {
      for (int j = 0; j < a[i]; j++) {
        cout << char(i + 'a');
      }
      return 0;
    }
  }
}

//http://codeforces.com/problemset/problem/202/A

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <list>

using namespace std;

#define pii pair <int, int>
#define vvi vector <int>
#define ll long long

string str, cur = "";
string result = "";
vector <string> values(0);

bool isPalindrome();

int main()
{
	int ii, jj;
	int tmp, len;

	cin >> str;

	for (ii = int(pow(2, double(str.size())) - 1); ii > 0; ii--)
	{
		for (jj = 0, tmp = ii; tmp > 0; jj++, tmp /= 2)
		{
			if (tmp & 1)
				cur += str[jj];
		}

		if (isPalindrome())
			values.push_back(cur);

		cur = "";
	}

	for (ii = 0, len = values.size(); ii < len; ii++)
		result = max(result, values[ii]);

	cout << result << endl;

	return 0;
}

bool isPalindrome()
{
	int ii;
	int center, len;

	len = cur.size();
	center = len / 2;

	for (ii = 0; ii < center; ii++)
	{
		if (cur[ii] != cur[len - ii - 1])
			return 0;
	}

	return 1;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <cstdlib>

using namespace std;
char c[20] , r[20];
bool used[20];
int n , o = -1;

void radi(int rn )
{
     if(rn == n)
     {
         char q[20];
         int l=0;
         for(int i=0;i<n;i++)
             if(used[i])
             {
                 q[l] = c[i];
                 l++;
             }
            int pal =1;
         for(int i=0;i<l;i++)
             if(q[i] != q[l-1-i])    pal = 0;
         if(pal)
         {
             if(o == -1)
             {
                 o = l;
                 for(int i=0;i<o;i++)    r[i] = q[i];
             }
             else
             {
                 int we=0;
                 for(int i=0;i<min(o,l);i++)
                     if( r[i] - q[i] != 0)
                     {
                         we = r[i] - q[i];
                         break;
                     }
                 if((we == -1 && l > o) || we<0)
                 {
                     o=l;
                     for(int i=0;i<o;i++)    r[i] =q[i];
                 }
             }
          }
     }
     else
     {
         used[rn] = 1;
         radi(rn+1);
         used[rn] = 0;
         radi(rn+1);
     }
}

int main()
{
    scanf("%s",&c);
    n = strlen(c);
    radi(0);
    for(int i=0;i<o;i++)
    printf("%c",r[i]);
    printf("\n");
    return 0;
}

#include<iostream>
using namespace std;
#include<string>
void largest(string s)
{
char max=s[0];
int n=0;
for (int i = 1; i < s.length();i++)
if (s[i]>max)
max = s[i];
for (int i = 0; i < s.length();i++)
if (s[i] == max)
n++;
for (int i = 0; i < n; i++)
    cout << max;
cout << endl;

}

    int main()
    {
        string s;
        cin >> s;
        largest(s);
        return 0;
    }

#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#define endl "\n"
#define ll long long int
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define f first
#define s second
#define sz(a) int((a).size())
#define typeof(x) __typeof__(x)
#define fi(i,n) for( int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
//tr(container name,iterator name)
#define present(c,x) ((c).find(x) != (c).end())
using namespace std;
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
   return (a.first > b.first);
}
struct greaterr
{
    template<class T>
    bool operator()(T const &a, T const &b) const {return a > b;}
};
int main()
{
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
	std::ios::sync_with_stdio(false);
    string ss;
    cin>>ss;
    int n = sz(ss);
    int freq[26]={0};
    for(int i=0;i<n;i++)
    {
        freq[ss[i]-'a']++;
    }
    int maxa = 0,pos=0;
    for(int i=25;i>=0;i--)
    {
        if(freq[i]>0)
        {
            pos=i;
            break;
        }
    }
    maxa=freq[pos];
    for(int i=0;i<maxa;i++)
    {
        cout<<char(pos+'a');
    }
	return 0;
}

#include<bits/stdc++.h>

int main() {
	char occ[26] = {0};
	char c;
	char str[111];
	char best = 'a';
	char bestq = 0;
	scanf("%s",&str);
	getchar();
	for(int i = 0; i < strlen(str); i++) {
		c = str[i];
		occ[c-'a']++;
		if(c > best) {
			best = c;
			bestq = occ[c-'a'];
		}
		if(c == best && occ[c-'a'] > bestq) {
			bestq = occ[c-'a'];
		}
	}

//	if(occ[best-'a']%2) occ[best-'a']-=1;
	int p = occ[best-'a'];
//	printf("%d\n",occ[best-'a']);
	char ans[p+1];
	for(int i = 0; i < p; i++) {
		ans[i] = best;
		ans[i+1] = '\0';
	}
	printf("%s\n",ans);
//	printf("%d\n",p);
//	printf("\n");
	return 0;
}

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

using namespace std;

int main(){
    string s;
    cin >> s;

    int L = s.size();

    string ans;

    for(int mask = 1;mask < (1 << L);++mask){
        string aux;

        for(int i = 0;i < L;++i)
            if(mask >> i & 1)
                aux += s[i];

        string aux2 = aux;
        reverse(aux2.begin(),aux2.end());

        if(aux == aux2)
            ans = max(ans,aux);
    }

    cout << ans << '\n';

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define mp make_pair
#define pb push_back
#define gcd(a, b)   __gcd(a, b)
#define lcm(a, b)  ((a)*((b)/gcd(a,b)))
#define pi 3.14159265358979323846
#define reus ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int32_t main()
{
	reus;

//	#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//	#endif

	string s,s1;
	cin>>s;
	int a[26]={0},i,j;
	for(i=0;i<s.length();i++)
	{
		a[(int)s[i]-97]++;
	}
	for(i=25;i>=0;i--)
	{
		if(a[i]!=0)
		{
			for(j=0;j<a[i];j++)
			cout<<char(i+97);
			break;
		}
	}
	return 0;
}

#include <iostream>
using namespace std;
int main ()
{
	char str[11];
	cin >> str;
	char a = str[0];
	int c = 1;
	for (int i = 1; i < strlen (str); i++)
	{
		if (a < str[i])
		{
			a = str[i];
			c=1;
		}
		else if (a == str[i])
			c++;
	}
	for (int i = 0; i < c; i++)
		cout << a;
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <climits>
#include <string>
#include <cctype>
#include <ctime>
#include <iosfwd>
#include <sstream>
#include <algorithm>
using namespace std;

#pragma region defines

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define PI 3.14159265358979
#define FOR(from, to, counter) for (int counter = from; counter < int(to); counter++)
#define FRQ(from, to, counter) for (int counter = from; counter <= int(to); counter++)
#define REP(to, counter) FOR(0, to, counter)
#define eps 1E-7
inline vi ReadFullVI(int count) {vi arrayname(count); REP(count, i) cin >> arrayname[i]; return arrayname; };
inline vi ReadVI(int count) {vi arrayname(count); REP(count, i) cin >> arrayname[i]; return arrayname; };
const int MOD = 1073741824;

#pragma endregion defines

int main(void)
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	double beginTime=clock();
#endif
	vi a(26); REP(26,i) a[i]=0;
	string s;
	cin >> s;

	REP(s.size(), i) ++a[s[i]-97];

	for (int i = 25; i >= 0; i--)
	{
		if (a[i])
		{
			REP(a[i], j) cout << char(i+97);
			break;
		}
	}

#ifndef ONLINE_JUDGE
	double endTime=clock();
	printf("\n***Elapsed = %.5lf******",(endTime-beginTime)/CLOCKS_PER_SEC);
#endif
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod (1000000007)
#define pi acos(-1)
#define INF 1000000000

int main() {

     string s;
     cin>>s;
     int i,n=s.size();
    	sort(s.begin(),s.end(),greater<char>());
    cout<<s[0];
    for(i=1;i<n;i++)
    	if(s[i]==s[0])
    		cout<<s[0];

    return 0;
}

#include<iostream>
#include<bits/stdtr1c++.h>
#define ll long long
using namespace std;

bool checkPalindrome(string s){
    string t = s;
    reverse(s.begin(),s.end());
    return s==t;
}

string LLPS(string s, string  t){
    int p = min(s.length(),t.length());
    for(int i=0;i<p;i++){
        if(s[i]>t[i]) return s;
        else if(s[i]<t[i]) return t;
    }
    if(s.length()>=t.length()) return s;
    return t;
}

int main(){

    string s,palindrome; cin>>s;
    int num = pow(2,s.length());
    for(int mask=1;mask<num;mask++){
        string temp ="";
        for(int i=0;i<s.length();i++){
            if(mask & (1<<i)) temp += s[i];
        }
        if(checkPalindrome(temp))
            palindrome = LLPS(palindrome,temp);
    }
    cout<<palindrome;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

bool is_pallim(string &s) {
    int n = s.length();
    for(int i = 0; i < n/2; i++) {
        if(s[i] != s[n-i-1]) return false;
    }
    return true;
}

int main() {
    ios::sync_with_stdio(false);

    string s;
    cin>>s;

    int n = s.length();

    string ans = "";

    for(int mask = 1; mask < (1<<n); mask++) {
        string palm = "";
        for(int ind = 0; ind < n; ind++) {
            if((mask|(1<<ind)) == mask) {
                palm += s[ind];
            }
        }

        if(is_pallim(palm) and palm > ans) {
            ans = palm;
        }

    }

    cout<<ans;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1.0);
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};
#define ll long long
#define inf int(1e9+7)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define l(s) s.size()
string s;
int alph[26];
int main()
{
	cin>>s;
	for(int i=0;i<l(s);i++)
		alph[s[i]-'a']++;
	char maxn=0;
	for(int i=0;i<l(s);i++)
		if(s[i]>=maxn)
			maxn=s[i];
	for(int i=0;i<alph[maxn-'a'];i++)
		cout<<maxn;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

/* Template */

#define ll long long
#define forit(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define work(i, start, end, interval) for(int i = start; i != end; i += interval)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define MIN(a, b) a = min (a, b)
#define MAX(a, b) a = max (a, b)
#define endl '\n'

#define fname ""

#define nxtnt getNext <int>()
#define nxtll getNext <ll>()

template <typename T>
inline T sqr (T x) {
    return x * x;
}

template <typename T>
inline T getNext () {
    T s = 1, x = 0, c = getc(stdin);
    while (c <= 32)
        c = getc(stdin);
    if (c == '-')
        s = -1, c = getc(stdin);
    while ('0' <= c && c <= '9')
        x = x * 10 + c - '0', c = getc(stdin);
    return x * s;
}

bool is (string &s) {
    int l = 0, r = s.size() - 1;

    while (l <= r) {
        if (s[l] != s[r])
            return false;

        if (r < l)
            return true;
        l++, r--;
    }
    return true;
}

int main () {
    #ifdef lcl
        freopen (fname".in", "r", stdin);
    #endif

    string s; cin >> s;
    string res;

    work (mask, 0, (1 << s.size()), 1) {
        string t = "";
        // cout << mask << endl;
        if (!mask)
            continue;
        work (i, 0, s.size(), 1) {
            if (mask & (1 << i))
                t += s[i];
        }
        if (is (t))
            res = max (res, t);
        // cout << t << endl;
    }

    cout << res;

    return 0;
}

#include <iostream>
#include <string>
#include <set>

using namespace std;

bool check(string s) {
    auto len = s.length();
    for (auto i = 0; i < len/2; i++) {
        if (s[i] != s[len - 1 - i]) {
            return false;
        }
    }
    return true;
}

int main() {
    string s, curr;
    set<string> storage;
    cin >> s;
    for (auto i = 0; i < (1 << s.length()); ++i) {
        curr = "";
        for (auto j = 0; j < s.length();++j) {
            if (i & (1 << j)) {
                curr += s[j];
            }
        }
        if (check(curr)) {
            storage.insert(curr);
        }
    }
    cout << *storage.rbegin();
    return 0;
}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <random>
using namespace std;

string solve(const string &s) {
    char c = *max_element(s.begin(), s.end());
    return (string(count(s.begin(), s.end(), c), c));
}

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

    string s;
    cin >> s;
    cout << solve(s);
}

#include <bits/stdc++.h>

using namespace std;

int main() {

    int i,n,sz;
    string s1;
    char ch;

    cin>>s1;

    sz = s1.size();

    multiset <char> ms;
    set <char> justSet;
    multiset <char> :: iterator it;

    for (i=0;i<sz;i++) {
        ms.insert(s1[i]);
        justSet.insert(s1[i]);
    }

    if (justSet.size()==1) {
        cout<<s1<<endl;
        return 0;
    }

    it=ms.end();
    it--;

    if (it==ms.begin())  {
        cout<<*it<<endl;
        return 0;
    }

    s1 = *it;
    ch = *it;
    it--;

    while (1) {
        if (*it!=ch) break;
        s1 = s1 + *it;
        it--;
    }

    cout<<s1<<endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
bool isPalindrome(string temp)
{
    string a=temp;
    reverse(temp.begin(),temp.end());
    return a==temp;
}
vector<string> generate_all(string s)
{
    //BitMasking
    vector<string> v;
    int n=s.size();
    for(int i=0;i<pow(2,n);i++)
    {
        string temp;
        for(int j=0;j<n;j++)
        {
            if(i>>j&1)
            temp.push_back(s[j]);
        }
        if(isPalindrome(temp))
        v.push_back(temp);
    }
    return v;
}
int main() {
	string s;
	cin>>s;
	vector<string> v;
	v=generate_all(s);
	sort(v.begin(),v.end());
	cout<<v[v.size()-1]<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main() {
	string sentence;
	cin >> sentence;
	char max = 'a';
	int n = sentence.length();
	for(int i = 0; i < n; i++) {
       if(sentence[i] > max)
       	    max = sentence[i];
	}
	for(int i = 0; i < n; i++)	{
		if(sentence[i] == max)
			cout << sentence[i];
	}
    cout<<endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

void rwFile() {
    freopen("INP.inp", "r", stdin);
    freopen("OUT.out", "w", stdout);
}

void solveA_LLPS() {
    string s; cin >> s;
    char x = 'a';
    int t = 0;
    for (int i = 0; i < (int)s.size(); i++) {
        if (s[i] > x) {
            x = s[i];
            t = 1;
        }
        else if (s[i] == x) t++;
    }
    for (int i = 0; i < t; i++) cout << x;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    //rwFile();
    solveA_LLPS();
}

# include <bits/stdc++.h>
using namespace std;
main(){

string s;

map<char,int>m;
cin>>s;
sort(s.begin(),s.end(),greater<char>());
for(int i=0;i<s.size();i++)
{
cout<<s[i];
if(s[i]!=s[i+1])
{
break;
}

}
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<long long,long long> > vpll;
typedef vector<vector<ll> > vvll;

#define PI 3.141592653589793
#define MOD 1000000007

int main()
{
	string s;
	cin>>s;
	vector<ll> freq(26,0);
	ll n=s.size();
	for(ll i=0;i<n;i++)
	{
		ll ch=s[i]-'a';
		freq[ch]++;
	}
	for(ll i=25;i>=0;i--)
	{
		if(freq[i]>0)
		{
			char ch=(char)(i+'a');
			for(ll j=0;j<freq[i];j++)
			{
				cout<<ch;
			}
			break;
		}
	}
	return 0;
}

#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
const int maxn=1000010;
bool v[15];
char ch[15],ans[15];

bool is(char *s){
    int i;
    int m=strlen(s);
    for(i=0;i<=m/2;i++){
        if(s[i]!=s[m-1-i]) return 0;
    }
    return 1;
}

void dfs(char *s,int step,int len){
    int i;
    if(step>len){
        return ;
    }
    if(is(ch)){
        if(strcmp(ch,ans)>0){
            strcpy(ans,ch);
        }
    }
    for(i=0;i<len;i++){
        if(!v[i]){
            v[i]=1;
            ch[step]=s[i];
            ch[step+1]='\0';
            dfs(s,step+1,len);
            v[i]=0;
        }
    }
}

int main(){
    char s[15];
    scanf("%s",s);
    int len=strlen(s);
    strcpy(ans,"\0");
    dfs(s,0,len);
    puts(ans);
    return 0;
}

#include <iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    int len=s.length();
    char p=s[len-1];
    cout<<p;
    for(int i=len-2;i>=0;i--){
        if(s[i]==p)
            cout<<s[i];
        else
            return 0;
    }
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<math.h>

#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b) && (a)!=-1 )?(a):(b))

#define FO(i,s,n,p) for(int i=(s);i<(n);i+=p)
#define FOD(i,s,n,p) for(int i=(s);i>(n);i-=p)

#define FOE(i,s,n,p) for(int i=(s);i<=(n);i+=p)
#define FODE(i,s,n,p) for(int i=(s);i>=(n);i-=p)

#define FOR(i,s,n) FO(i,s,n,1)
#define FORE(i,s,n) FOE(i,s,n,1)
#define FORD(i,s,n) FOD(i,s,n,1)
#define FORDE(i,s,n) FODE(i,s,n,1)

#define GI(i) scanf("%d",&i)
#define GU(i) scanf("%u",&i)
#define GLL(i) scanf("%lld",&i)
#define GLLU(i) scanf("%llu",&i)
#define GW(s) scanf("%s",s)
#define GS(s) gets(s)

#define WI(i) printf("%d",i)
#define WU(i) printf("%u",i)
#define WLL(i) printf("%lld",i)
#define WLLU(i) printf("%llu",i)
#define WS(s) printf("%s",s)

#define S putchar(' ')
#define NL putchar('\n')

#define ML(type,size) (type *)malloc(sizeof(type)*size)
#define CL(type,size) (type *)calloc(sizeof(type)*size)

typedef long long ll ;
typedef unsigned long long llu;

#include<vector>
#include<utility>
#include<algorithm>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<string>
#include<iostream>
#include<map>

#define pb push_back
#define mp make_pair

using namespace std;

#include<assert.h>

#define inf ((1<<30)-1)

vector<string> sul;

bool chkpol(string ss)
{
  int len=ss.length();

  FOR(i,0,len/2)
  if(ss[i]!=ss[len-i-1])
    return 0;

  return 1;
}

string in;
string best="";
int len;

bool cm(string a,string b)
{
  if(b=="")
    return 1;

  int al=a.size(),bl=b.size();

  if(al>bl)
    {
      bool ki=1;
      FOR(i,0,bl)
      {
        if(a[i]!=b[i])
          ki=0;
      }
      if(ki)
        return 1;
    }
  int ll=MIN(al,bl)-1;

  if(ll==0)
    return a[0]>b[0];
  else
    FOR(i,0,ll)
    {
      if(a[i]==b[i])
        {
          if(a[i+1]>b[i+1])
            return 1;
        }
      else
        return 0;
    }

  return 0;
}

vector<string> func(int ll)
{
  if(ll<0)
    {
      vector<string> res;
      res.pb("");
      return res;
    }

  vector<string> ss=func(ll-1);
  int lastsz=ss.size();
  FOR(j,0,lastsz)
  {
    string blax=ss[j]+in[ll];
    //cout<<blax<<endl;

    if(chkpol(blax) && cm(blax,best))
      best=blax;

    ss.pb(blax);

  }

  return ss;

}

int main()
{
#define contest
//#undef contest

#ifndef contest
  freopen("C:\\a","r",stdin);
#else
#endif

  cin>>in;
  len=in.length();
  func(len-1);

  cout<<best;

  return 0;
}

#include <iostream>

using namespace std;
int main()
{
    char m='.';
    string s;
    cin >> s;
    for(int i=0;i<s.size();i++)
    {
        if(m<s[i])
            m=s[i];
    }
    string y="";
    for(int j=0;j<s.size();j++)
    {
        if(s[j]==m)
            y=y+s[j];
    }
    cout << string(y);
    return 0;
}

#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define ci const int
#define ni ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define cd const double
#define cll const long long
#define ld long double
#define sh short int
#define S second
#define F first
#define Y "YES"
#define N "NO"

using namespace std;
typedef pair<int, int> pii;

string s;
int mx = INT_MIN;

int main()
{

   // freopen("input.txt", "r", stdin);   freopen("output.txt", "w", stdout);    freopen("errors.txt", "w", stderr);
    ni;

    cin >> s;
    for(int i = 0; i < s.size(); i ++)
    {
    	mx = max(int(s[i]), mx);
    }

    for(int i = 0; i < s.size(); i ++)
    {
    	if(int(s[i]) == mx)
    	{
    		cout << s[i];
    	}
    }

    cout << '\n';

//    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    return 0;
}

#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int occ[512];
int main(){
    char x[12];
    scanf("%s", x);
    int largest = (int)(x[0]-'a');
    for(int i =0;i<strlen(x);i++){largest = max( (int)(x[i]-'a'), largest); occ[(int)(x[i]-'a')]++;}
    for(int i =0;i<occ[largest];i++) printf("%c",(char)(largest+'a'));
    printf("\n");
    return 0;
}

#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

int main()
{
    //freopen("input.txt","r",stdin);
    int t = 4;
//while(t--)
{
    string s;
    cin >> s;
    char largest = 'a' - 1;int count = 0;
    for(int i = 0; i < s.size(); ++i)
    {
        if(s[i] > largest)
        {
            largest = s[i];
            count = 1;
        }
        else if(s[i] == largest)
        {
            count++;
        }
    }
    for(int i = 0; i < count; ++i)
    {
        cout << largest;
    }
    cout << endl;
}
    return 0;
}

#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <utility>
#include <deque>
#include <list>
#include <string>
#include <cassert>
#include <cstring>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <cmath>

using namespace std;

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

#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()

#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define ll long long
#define ld long double
#define pii pair <int,int>
#define sz(a) (int)(a).size()
#define np next_permutation
#define ull unsigned long long
const int INF = (int)1e9;
const long long INF64 = (long long) 1e18;
const long double eps = 1e-9;
const long double pi = 3.14159265358979323846;
bool ineedoutputfile = false;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a%b) : a;
}

ll lcm (ll a, ll b) {
	return (a*b)/gcd(a,b);
}
string isa = "aeiou";
bool ispal (string s) {
	for(int i=0; i<(s.size())/2; i++)
		if (s[i]!=s[s.size()-i-1])
			return false;
	return true;
}
int main () {

#ifdef LocalHost
	if (0) freopen("input.txt","rt",stdin);
	if (ineedoutputfile)
		freopen("output.txt","wt",stdout);
#endif
	string s;
	cin >> s;
	int n = s.size();
	string ans = "";
	bool first = true;
	forn(i,(1<<n)) {
		string temp = "";
		forn(j,n)
			if (i & (1<<j))
				temp+=s[j];
		if (ispal(temp)) {
			if (first) {
				ans = temp;
				first = false;
			} else
				if (ans < temp)
					ans = temp;
		}
	}
	cout << ans;
}

#include <iostream>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <ctype.h>
#include <queue>
#include <vector>
#include <algorithm>
#include <stdio.h>
#define File_in(input) freopen(input, "r", stdin)
#define File_out(output) freopen(output, "w", stdout)
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int,int> point;
const int inf = (1<<29)-1;
const int mod = 1000000007;
const int ms = 1e9+100;
bool cmp (point p1, point p2) {
  return p1.first > p2.first;
}

int main () {
    //File_in("input.txt"); File_out("output.txt");
    ios_base::sync_with_stdio(false);
    char x,a = 'a';
    int c[32+'a'] = {0};
    while (1) {
        cin.get(x);
        if (x  == '\n')
            break;
        c[x]++;
        if (x > a) {
            a = x;
        }
    }
    while(c[a]--)
        printf("%c",a);
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <climits>
#include <string>
#include <cctype>
#include <ctime>
#include <iosfwd>
#include <sstream>
#include <algorithm>
using namespace std;

#pragma region defines

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define PI 3.14159265358979
#define FOR(from, to, counter) for (int counter = from; counter < int(to); counter++)
#define FRQ(from, to, counter) for (int counter = from; counter <= int(to); counter++)
#define REP(to, counter) FOR(0, to, counter)
#define eps 1E-7
inline vi ReadFullVI(int count) {vi arrayname(count); REP(count, i) cin >> arrayname[i]; return arrayname; };
inline vi ReadVI(int count) {vi arrayname(count); REP(count, i) cin >> arrayname[i]; return arrayname; };
const int MOD = 1073741824;

#pragma endregion defines

int main(void)
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	double beginTime=clock();
#endif
	vi a(26); REP(26,i) a[i]=0;
	string s; cin >> s;

	REP(s.size(), i) ++a[s[i]-97];

	for (auto i = 25; i >= 0; i--)
		if (a[i])
		{
			REP(a[i], j) cout << char(i+97);
			break;
		}

#ifndef ONLINE_JUDGE
	double endTime=clock();
	printf("\n***Elapsed = %.5lf******",(endTime-beginTime)/CLOCKS_PER_SEC);
#endif
}

#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
	string s;
	cin >> s;
	sort(s.rbegin(),s.rend());
	int n = s.length();
	for(int i = 0; i < n;i++)
	{
		if(s[i]==s[0])
		{
			cout<<s[i];
		}
	}
	return 0;
}

#include<iostream>
#include<string>
using namespace std;
string test(string str){
   string temp="";
   int max=0;
   for(int i=0;i<str.length();++i){
      if(max<=str[i]){
         if(max==str[i]){
            temp+=max;
         }else{
            temp=str[i];
         }
         max=str[i];
      }
   }
   return temp;
}

int main(){
   string str;
   cin>>str;
   cout<<test(str)<<endl;
   return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main ()
{

	string cadena;
	char extreme = 'a';
	int veces = 0;

	getline(cin, cadena);

	for (string::iterator iter = cadena.begin(); iter != cadena.end(); iter++)
	{
		if (*iter >= extreme) extreme = *iter;
	}
	for (string::iterator iter = cadena.begin(); iter != cadena.end(); iter++)
	{
		if (*iter == extreme) veces++;
	}

	for (int i = 0; i < veces; i++)
	{
		cout << extreme;
	}
	cout << endl;

	return 0;
}

/*int main ()
{
	string cadena;
	char extreme = 'a';

	getline(cadena);

	for (string::iterator iter = cadena.begin(), iter != cadena.end(); iter++)
	{
		if (*iter > cadena)
		{

		}
	}

	return 0;
}*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")

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

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef long double ld;
const ll INF = 2e18;
void solve(int tc)
{
	string s;cin>>s;
	sort(s.begin(),s.end());
	char y=s[s.length()-1];
	map<char,int> p;
	for(char x:s)
		p[x]++;
	int t=p[s[s.length()-1]];
	for(int i=1;i<=t;i++)
		cout<<y;
	cout<<"\n";
}
int main()
{
	FAST
	int t=1;//cin>>t;
	for(int i=1;i<=t;i++)
	{
		solve(t);
	}
return 0;
}

#include <cstdio>
#include <iostream>

int main(){

    std::string input; getline(std::cin, input);

    char outChar = 'a'; int outNum = 0;
    for(int k = 0; k < input.size(); k++){
        if(input[k] > outChar){outChar = input[k]; outNum = 1;}
        else if(input[k] == outChar){++outNum;}
    }

    for(int k = 0; k < outNum; k++){printf("%c", outChar);}

    return 0;
}

#include "bits/stdc++.h"

using namespace std;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define REP(i, a, b) for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!

int alphabet[26];

string llps(string word)
{
    memset(alphabet, 0, sizeof alphabet);
    char a = 'a';
    for (auto c : word)
    {
        alphabet[c - 97]++;
        if (c > a)
        {
            a = c;
        }
    }

    string res = "";
    for (int i = 0; i < alphabet[a - 97]; i++)
    {
        res += a;
    }

    return res;
}

int main()
{
    string x;

    cin >> x;

    cout << llps(x) << endl;

    return 0;
}

//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word
//Use(<<)for multiplication
//Use(>>)for division
//find_by_order -> value at index
//order_of_key -> index of value
//in Floyd-Warshall Algo, k is outer loop
//__gcd(0,0) gives runtime error
//power(a,b) == power(a,b%phi(a)) Fermet's Theorem
//never use "=" operator in compare function
//For checking odd cycles, check bipartite
//Range in iterative segment tree [a,b)
//no of prime numbers in range : (70,19) , (1000,168) , (100000,1229) , (sqrt(10^9),3409) ;
//use external for-loop(in driver function) to avoid memory limit exceeded in top-down dp

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007ll //998244353ll
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=200005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }
int fact[N],inv[N];
void pre()
{
    fact[0]=1;
    inv[0]=1;
    for(int i=1;i<N;i++)
    fact[i]=(i*fact[i-1])%mod;
    for(int i=1;i<N;i++)
    inv[i]=power(fact[i], mod-2, mod);
}
int nCr(int n, int r)
{
    if(r>n)
    return 0;
    int p=1;
    for(int i=n;i>n-r;i--)
    p*=i;
    for(int i=1;i<=r;i++)
    p/=i;
    return (int)p;
}

void solve(){
    string s;   cin>>s;
    mci mp;
    for(int i = 0;i < s.length();i++){
        mp[s[i]]++;
    }
    for(int i = 25;i >= 0;i--){
        char ch = 'a' + i;
        if(mp[ch] > 0){
            for(int j = 0;j < mp[ch];j++){
                cout<<ch;
            }
            break;
        }
    }
    return ;
}

int32_t main(){
	solve();
}

#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <hash_set>
#include <hash_map>
#include <map>
#include <functional>
#include <cmath>

#if !defined(__GNUC__)
#include <hash_set>
#include <hash_map>

typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed long int32_t;
typedef unsigned long uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;

typedef stdext::hash_set<size_t>    hash_set_size_t;
#else // !defined(__GNUC__)

#endif // !defined(__GNUC__)

typedef long double double_t;
typedef std::string string8_t;

typedef std::vector<size_t> vector_size_t;
typedef std::set<size_t> set_size_t;
typedef std::multiset<size_t> multiset_size_t;

typedef std::vector<string8_t> vector_string8_t;
typedef std::set<string8_t> set_string8_t;
typedef std::multiset<std::string> multiset_string8_t;

// Auxiliary functions definition
//
template<typename T> inline T Abs(const T a) { return a < 0 ? -a : a; }
template<typename T> inline T Min(const T a, const T b) {return a < b ? a : b;}
template<typename T> inline T Max(const T a, const T b) {return a > b ? a : b;}

static const double_t eps = 1.0e-09;
template<typename T> inline T IsEqual(const T a, const T b) { return Abs(a - b) < eps; }
template<typename T> inline T IsGreater(const T a, const T b) { return a > b + eps; }
template<typename T> inline T IsLess(const T a, const T b) { return a + eps < b; }

template<typename T> inline string8_t ToStr(const T& val) { std::ostringstream ostr; ostr << val; return ostr.str(); }
template<typename T> inline bool FromStr(const string8_t& str, T& val) {std::istringstream istr(str); istr >> val; return !!istr; }

#if defined(ONLINE_JUDGE)
template<size_t id> class StopWatch { };
#else //defined(ONLINE_JUDGE)
#include <library/lib_stopwatch.h>
#endif //defined(ONLINE_JUDGE)

bool IsPalindrom(const string8_t& str)
{
    const size_t n = str.size();
    const size_t h = str.size() / 2;
    for (size_t i = 0; i < h; i++)
    {
        if (str[i] != str[n - i - 1])
            return false;
    }
    return true;
}

bool Solve(std::istream& ist, std::ostream& ost, const bool multipleTestMode)
{
    StopWatch<1> sw;

    // first input operation
    //
    string8_t str;
    ist >> str;

    // /////////////////////

    if (multipleTestMode && !ist)
    {
        return false;
    }

    // other input operation and calculations
    //
    const size_t n = str.size();
    const char *const strBegin = str.c_str();

    string8_t maxStr;

    const size_t maxMask = 1UL << n;
    for (size_t mask = 0; mask < maxMask; mask++)
    {
        string8_t curStr;
        for (size_t i = 0; i < n; i++)
        {
            if ((1UL << i) & mask)
                curStr += strBegin[i];
        }

        if (IsPalindrom(curStr) && maxStr < curStr)
        {
            maxStr = curStr;
        }
    }

    ost << maxStr << std::endl;

    // /////////////////////

    return multipleTestMode;
}

int main()
{
    std::istream& ist = std::cin;
    std::ostream& ost = std::cout;
#if defined(ONLINE_JUDGE)
    Solve(ist, ost, false);
#else
    while(Solve(ist, ost, true)) {};
#endif
}

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <stack>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REV(i,b,a) for(int i=(a);i>=(b);i--)
#define mp make_pair
#define pb push_back
#define SZ(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()

using namespace std;
double PI = 3.14159;
int dX[] = { 1, -1, 0, 0 };
int dY[] = { 0, 0, 1, -1 };
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s;
    map<char, int> mp1;
    cin >> s;
    FOR(i, 0, SZ(s))
        mp1[s[i]]++;
    for (char i = 'z'; i >= 'a'; i--)
    {
        if (mp1[i])
        {
            while (mp1[i]--)
                cout << i;
            break;
        }
    }
}

#include <iostream>
#include<string>
#include<string.h>
#include<sstream>
#include<algorithm>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
#include<utility>
#include<tuple>
#include<map>
#include<bitset>
#include<memory>
#include<cmath>
#include<iomanip>
#include<numeric>

using namespace std;

typedef long long 						LL ;
typedef unsigned long long				ULL;
typedef vector<int>						vi ;
typedef vector<vi>						vvi;
typedef pair<int,int> 					pii;

#define scf							scanf
#define prf							printf
#define all(c)						c.begin(),c.end()
#define sz(c)						(int)(c.size())
#define pb							push_back
#define eb							emplace_back
#define popb						pop_back
#define mp							make_pair
#define xf							first
#define ys							second
#define lp(i,s,e)					for(__typeof(e) i=s ; i<e ;  ++i)
#define lpr(i,e,s)					for(__typeof(e) i=e ; i>s ;  --i)
#define lpo(var , c)				for(const auto &var : c)
#define mod							1000000007
#define OOi							(~(1<<31))
#define OOl							(~((LL)1<<63))
#define PI							(3.141592654)
#define EPS							(1e-7)
//_______________________________________________________________________________.
string temp,P,g;
int n;

bool isp(){
	int n=temp.length();
	int e=(n+1)/2;
	lp(i,0,e)
		if(temp[i]!=temp[n-1-i])return 0;
	return 1;

}

void f(int i=0,int len=0){
	if(i==n){
		if(len==0)return;
		if(temp>P && isp())P=temp;
		return ;
	}
	f(i+1,len);
	temp.pb(g[i]);
	f(i+1,len+1);
	temp.popb();
}
int main(){
cin>>g;
P=g[0];
n=g.length();
f();
cout<<P;
return 0;
}

#include <iostream>
#include <set>
#include<string.h>
#include <sstream>
#include<bits/stdc++.h>
#include <cstdlib>
#include <map>
#include <queue>
#include <cmath>
using namespace std;
#define ll long long
#define pb push_back

int main()
{
    ios_base::sync_with_stdio(false);
    ll a[26];
    memset(a,0,sizeof(a));
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++)
    {
        a[s[i]-97]++;
    }
    for(int i=25;i>=0;i--)
    {
        if(a[i]!=0)
        {
            for (int j=0;j<a[i];j++)
                cout<<(char)(i+97);
            return 0;
        }
    }
    return 0;
}

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    string s;
    cin >> s;
    char mx = 0;
    int cnt = 0;
    for (char i: s) {
        if (i > mx) mx = i, cnt = 1;
        else  if (i == mx) ++cnt;
    }
    for (int i = 0; i < cnt; i++) cout << mx;
    cout << endl;
}

#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	string s; cin >> s;
	char x = (char)0;
	for (auto c : s) {
		x = max(c, x);
	}
	for (auto c : s) {
		if (c == x)cout << c;
	}
}

#include <iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	string a;
	cin >> a;
	int Max = INT_MIN;
	for (int i = 0; i < a.size(); i++)
		Max = max(Max, (int)a[i]);
	char s = Max;
	for (int i = 0; i < count(a.begin(), a.end(), s); i++)
		cout << s;
	return 0;
}

# include<iostream>
# include<string>
# include<vector>
# include<cmath>
# include<algorithm>
# include<map>
# include<set>
using namespace std;
int	n,  sum = 0, x, z;
int main() {
	string s, t;
	cin >> s;

	for (auto c : s)
		if (c == *max_element(s.begin(), s.end()))
		//	t += m;
//	if (rand() % 5 == 0)
		//cout << 'S';
	putchar(c);
	}

#include<bits/stdc++.h>

#define x first
#define y second
#define pb push_back
#define inf 0x3f3f3f3f
#define mod 1000000007
#define sq(x) ((x)*(x))
#define bit(x, y) (((x)>>(y))&1)
#define bctz(x) (__builtin_ctz(x))
#define bclz(x) (__builtin_clz(x))
#define bclzl(x) (__builtin_clzl(x))
#define bctzl(x) (__builtin_ctzl(x))
#define bpt(x) (__builtin_popcount(x))
#define bptl(x) (__builtin_popcountll(x))
#define PQ priority_queue<pii, vector<pii>, greater<pii> >
#define eps 1e-8
#define squ(a, b) (a)*(a)+(b)*(b)
#define pi 3.1415926535897932384626433832795

using namespace std;

typedef double DO;
typedef long long INT;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}
template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

template <class T> inline void gn(T &x) {char c, sg=0; while(c=getchar(), (c>'9' || c<'0') && c!='-'); for((c=='-' ? sg=1, c=getchar() : 0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0'; if(sg) x=-x;}
template <class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}
template <class T1, class T2, class T3> inline void gn(T1 &x1, T2 &x2, T3 &x3) {gn(x1, x2), gn(x3);}
template <class T1, class T2, class T3, class T4> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4) {gn(x1, x2, x3), gn(x4);}
template <class T1, class T2, class T3, class T4, class T5> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5) {gn(x1, x2, x3, x4), gn(x5);}

template <class T> inline void print(T x) {if(x<0) {putchar('-'); return print(-x);} if(x<10) {putchar('0'+x); return ;} print(x/10); putchar(x%10+'0');}
template <class T> inline void println(T x) {print(x); putchar('\n');}
template <class T> inline void printsp(T x) {print(x); putchar(' ');}
template <class T1, class T2> inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}
template <class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}
template <class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}
template <class T1, class T2, class T3, class T4, class T5> inline void print(T1 x1, T2 x2, T3 x3, T4 x4, T5 x5) {printsp(x1), printsp(x2), printsp(x3), printsp(x4), println(x5);}

int power(int a, int b, int m, int ans=1) {
	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;
	return ans;
}

char s[20];
int a[20];

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	scanf(" %s", s);
	int n=strlen(s);
	sort(s, s+n);
	reverse(s, s+n);
	char t=s[0];
	for(int i=0; i<n; i++){
		if(s[i]!=t)		break;
		printf("%c", t);
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	int i, k = 1, j;
	cin >> s;
	sort(s.begin(), s.end());
	reverse(s.begin(), s.end());
	char p=s[0];
	for (i = 0; s[i] != '\0'; i++)
	{
		if (s[i] == p)
		{
			cout << s[i];
		}
	}
}

#include <bits/stdc++.h>
#include <algorithm>
#include<string>
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<climits>
#define ll unsigned long long
#define N (1000*1000)
using namespace std ;

int main()
{
    string s;cin >> s; int a[26] = {0} ;
     for(int i=0;i<s.length();i++) a[s[i] - 'a']++;
    for (int i = 25; i > -1 ; i--)
    {
        if (a[i])
        {
            while (a[i]--)
                cout << char(i + 'a');
            return 0;
        }
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{

string s;
cin>>s;
 unsigned int pow_set_size = pow(2, s.size());
    int counter, j;
  set <string, greater <string> > g;
string f,k;
    for(counter = 0; counter < pow_set_size; counter++)
    {
    for(j = 0; j < s.size(); j++)
    {

        if(counter & (1 << j))
{
 f.push_back(s[j]);
   }

    } k=f;
reverse(f.begin(),f.end());
if(f==k)
g.insert(k);
k.clear();
f.clear();
}
set< string, greater<string> > ::iterator it;
cout<<*g.begin();
}

#include<iostream>
#include<string>
#include<stack>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    stack<char>st;
    string str;
    cin>>str;
    char mm=*max_element(str.begin(),str.end());
    string str1;
    for(int i=0 ; i<str.size() ; ++i)
    if(mm==str[i])
    str1.push_back(str[i]);
    cout<<str1<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
/*int larg(string s)
{
    int sum=0;
    for(int i=0; i<s.size(); i++)
    {
        sum=s[i];
    }
    return sum;
}*/
int main()
{
    string a,t,s;
    cin>>a;
    int val=0;
    for(int i=0; i<a.size(); i++)
    {
        if(val<a[i])
        {
            val=a[i];
            s=a[i];
        }
    }
    //cout<<s<<endl;
    //cout<<val;
    //sort(a.begin(),a.end());
    for(int i=0;i<a.size();i++)
    {
        if(a[i]==val)
        {
            t+=a[i];
        }
    }
    cout<<t<<endl;
    return 0;
}

#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<vector>
using namespace std;
bool lox(string d)
{
    for (int h=0;h<d.length()-1;h++)
    {
    if (d[h]>d[h+1])
    return false;
    }
    return true;
}
int main()
{

    string s,a="",fin="";
    cin>>s;

    for (int i=0;i<(1<<s.length());i++)
    {
        a="";
        for (int j=0;j<s.length();j++)
        {
        if ((i>>j)&1)
        {
        a+=s[j];
        }
        }
        if (fin<a&&lox(a)==true)
        {
        fin=a;
        }
    }
    cout<<fin<<"\n";
}

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

vector<string> s1;

void findallsub(string s,string o){
    if(s.empty()){
        s1.push_back(o);
        return;
    }

    findallsub(s.substr(1),o+s[0]);
    findallsub(s.substr(1),o);
}

bool ispal(string s){
    string t = s;
    reverse(t.begin(),t.end());
    return s==t;
}
int main()
{
    string s;
    cin>>s;

    findallsub(s,"");
    string lstr ;
    for(int i=0;i<s1.size();i++){
        string sub = s1[i];
        if(ispal(sub)){
            if(lstr<sub){
                lstr = sub;
            }
        }

    }
    cout<<lstr<<endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
char s[15];
int vis[30];
int ma=-1;
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	for(int i=1;i<=n;i++){
		if(s[i]-'a'>=ma){
			ma=s[i]-'a';
			vis[ma]++;
		}
	}

	for(int i=1;i<=vis[ma];i++){
		printf("%c",ma+'a');
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	char maxch='a';
	cin>>a;
	for(int i=0;i<a.length();i++)
	{
		if(a[i]>maxch) maxch=a[i];
	}
	for(int j=0;j<a.length();j++)
	{
		if(a[j]==maxch) cout<<maxch;
	}
	cout<<endl;
	return 0;
}

#include<iostream>
#include<string>
#include<stdio.h>
#include<cstring>

using namespace std;

string st;
int i,j,len;
int cnt[26];

int main() {

	while(cin>>st)
	{
		memset(cnt,0,sizeof(cnt));
		len=st.size();
		for(i=len-1;i>=0;i--)
			cnt[st[i]-'a']++;
		for(i=25;i>=0;i--)
			if(cnt[i])
			{
				for(j=cnt[i];j>0;j--)
					printf("%c",'a'+i);
				break;
			}
		printf("\n");
	}

	return 0;

}

#include<bits/stdc++.h>
#define lld long long int
#define T int t;cin>>t;for(;t!=0;t--)
using namespace std;
int main(){
    lld i,c=0,j='a';
    string s;
    cin>>s;
    for(i=0;i<s.size();i++){
        if(j<s[i]){
            c=1;j=s[i];
        }
        else if(j==s[i]) c++;
    }
    for(i=0;i<c;i++){
        cout<<char(j);
    }
    cout<<endl;
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
int ar[100];
#define FOR(a,b,c) for(int a=b;a<=c;a++)
int main()
{
	memset(ar,0,sizeof ar);
	string tc;
	cin>>tc;
	FOR(i,0,tc.size()-1)
	{
	    ar[tc[i]-'a']++;
	}
	int maks=0;
	int semmaks=0;
	FOR(i,0,25) if(ar[i])
	{
	    maks=ar[i];
	    semmaks=i;
	}
	char b=semmaks+'a';
	FOR(i,1,maks) cout<<b;
	cout<<endl;
	return 0;
}

#include<iostream>
#include<string>
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s, t;
  cin >> s;
  for(char c : s) if(*max_element(s.begin(), s.end()) == c) t += c;
  cout << t;
  return 0;
}
//big brother help😂😂😂😂😂//

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <deque>
#include <iterator>
#include <stack>
#include <complex>
#include <ctime>
#include <memory.h>
#include <iomanip>
#include <cstdio>
#include <assert.h>

using namespace std;

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

	string n;

	char max='a';

	cin >> n;
	int cnt = 0;
	for (int i=0;i<n.size();i++)
	{
		if (max<n[i])
		{
			max=n[i];
		}
	}
		for (int i=0;i<n.size();i++)
	{
		if (max==n[i])
		{
			cnt++;
		}
	}

		for (int i=1;i<=cnt;i++)
		{
			cout << max;
		}
}

#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
#define fil(x) memset(x, 0, sizeof(x))
#define fillb(x) memset(x,false,sizeof(x))
#define fillm(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define pll pair<int, int>
#define pf printf
#define sf scanf
#define all(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define fo(i,n) for(int i=0;i<n;i++)
#define of(i,n) for(int i=n-1;i>=0;i--)
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define nl endl

typedef unsigned long long lll;
typedef long long ll;
int knigtx8[] = {2, 2, -2, -2, 1, 1, -1, -1}; ///knight move in chess
int knigty8[] = {1, -1, 1, -1, 2, -2, 2, -2}; ///knight move in chess
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; ///for 8 directions
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1}; ///for 8 directions
int dx4[] = {0, 0, 1, -1}; ///for 4 directions
int dy4[] = {1, -1, 0, 0}; ///for 4 directions
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

int atoz(){
    int frnt,bck,nibo,present,i;string s;
        frnt = abs(s[i]-present);
        bck = 26-frnt;
        nibo = min(frnt,bck);
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

int main()
{
    IOS;
    string s;cin>>s;
    sort(all(s));
    reverse(all(s));
    char ch;
    int n=s.size();
    if(n==1){
        cout<<s; return 0;
    }
    fo(i,s.size()-1)
    {
        if(s[i]!=s[i+1]){
            ch=s[i];
            cout<<s[i];
            break;
        }
        else{
                ch=s[i];
            cout<<s[i];
        }
    }
    if(s[n-1]==ch)cout<<s[n-1];
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    char last_one = s[s.size() - 1];
    string res;
    for(int i = s.size() - 1; i >= 0  && (s[i] == last_one); i--){
        res += s[i];
    }
    cout << res;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main(){
	int i;
	string s;

	cin >> s;

	sort(s.begin(), s.end());

	i = s.size() - 1;

	while(s[i] == s[s.size() - 1])
		cout << s[i--];

	cout << endl;

	return 0;
}

#include<iostream>
#define fastScan std::ios::sync_with_stdio(0)

using namespace std;

int main()
{
    fastScan;
    int x=0,i,k;
    string s;
    char ans[10]="";
    cin>>s;
    for(i=0;s[i]!=0;i++)
    {
        if(s[i]>x)
            x=ans[0]=s[i],k=1;
        else if(s[i]==x)
            ans[k++]=s[i];
    }
    for(i=0;ans[i]==x;i++)
        cout<<ans[i];
}

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

int main()
{
    string s, ans; cin >> s;
    char maxi = *max_element(s.begin(), s.end());
    for(int i = 0; i < s.size(); i ++)
      if(s[i] == maxi)
        ans += s[i];
    cout << ans << endl;
}

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
   string s,z="";
   cin>>s;
   sort(s.begin(),s.end());

   for(int i=s.size()-1;i>=0;i--)
   { if(s[i]==s[s.size()-1]){z+=s[i];}    }
   cout<<z<<endl;

return 0;
}

#include<bits/stdc++.h>

int main() {
	char occ[26] = {0};
	char c;
	char str[111];
	char best = 'a';
	char bestq = 0;
	scanf("%s",&str);
	getchar();
	for(int i = 0; i < strlen(str); i++) {
		c = str[i];
		occ[c-'a']++;
		if(c > best) {
			best = c;
			bestq = occ[c-'a'];
		}
		if(c == best && occ[c-'a'] > bestq) {
			bestq = occ[c-'a'];
		}
	}

//	if(occ[best-'a']%2) occ[best-'a']-=1;
	int p = occ[best-'a'];
//	printf("%d\n",occ[best-'a']);
	char ans[p+1];
	for(int i = 0; i < p; i++) {
		ans[i] = best;
		ans[i+1] = '\0';
	}
	printf("%s\n",ans);
//	printf("%d\n",p);
//	printf("\n");
	return 0;
}

#include <iostream>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

int main() {
	string in;
	cin >> in;
	map<char, int> mp;
	for(int i = 0; i<=in.size(); i++) mp[in[i]]++;
	char res = 'a';
	int count = mp['a'];
	for(char i = 'a'; i<='z'; i++)	if(mp[i]) res = i, count = mp[i];
	for(int i=0; i<count; i++)
		cout<<res;
	cout<<endl;
	return 0;
}

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

using namespace std;

string str;
char res[20];

int main()
{
	cin >> str;
	int count = 0;
	res[count++] = str[str.length() - 1];
	char max = res[0];
	for (int i = str.length() - 2; i >= 0; i--) {
		if (str[i] >= max){
			res[count++] = str[i];
            max = str[i];
        }
	}

	char c = res[count - 1];
	for (int i = count - 1; i >= 0; i--) {
		if (res[i] == c)
			cout << res[i];
		else
			break;
	}
	cout << endl;

	return 0;
}

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <utility>
#include <algorithm>
#include <bitset>
#include <cassert>

using namespace std;

#define SZN 105
#define MXN 100005
#define _ ios_base::sync_with_stdio(0);
#define debug
#define x first
#define y second

typedef long long int LLI;
typedef pair<int, int> PII;

const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-8; // 1e-10 sometimes; check eps when using double
const double pi = acos(-1.0);
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};

/* structs */

/* globals */
int cnt[300];

/* function declarations */

/* Problem */
int main() { _ // disable sync with stdio
    string s;
    cin >> s;
    int mx = 0;
    for (int i = 0; i < s.length(); ++i) {
        mx = max(mx, (int) s[i]);
        cnt[s[i]]++;
    }
    while (cnt[mx]) {
        cout << (char)mx;
        --cnt[mx];
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int cnt,temp=0,j=0,temp1;
    string s;
    string t;
    cin>>s;
    char ch;
    for(ch='z';ch>='a';ch--)
    {
          cnt=0;
        for(int k=temp;k<s.size();k++)
        {
            if(s[k]==ch)
            {
                cnt++;
            }
        }
            if(cnt>=1)
            {
               for(int i=temp;i<s.size();i++)
               {
                   if(s[i]==ch)
                   {
                       t.push_back(ch);

                       temp1=i;

                   }

               }
               temp=temp1;
            }

    }
    cout<<t;
    return 0;
}

#include<bits/stdc++.h>
#include<iostream>

using namespace std;
typedef long long ll;
string s,ans="",ss="";
void bc(int i)
{
    if(ss==s)
        return;
    string str=ss;
    reverse(str.begin(),str.end());
    if(str==ss)
        ans=max(ss,ans);
    if(i>=s.size())
        return ;
        for(int j=i;j<s.size();j++)
        {
            ss.push_back(s[i]);
            bc(j+1);
            ss.erase(ss.size()-1,1);
        }
}
class run
{
    public:
    run()
    {
    }
    private:
    string s;

};
int main()
{
    cin>>s;
    ans=s;
    sort(ans.begin(),ans.end());
    ans=ans[ans.size()-1];
    bc(0);
    cout<<ans;
    return 0;
}

#include <stdio.h>
#include <string.h>

int main()
{
	char s[11];
	int cnt[26] = {0};
	scanf(" %s", s);
	const int len = strlen(s);
	for (int i = 0; i < len; i++)
		cnt[s[i] - 'a']++;

	int j = 26;
	while (cnt[j] == 0)
		j--;
	for (int i = 0; i < cnt[j]; i++)
		putchar('a' + j);
	putchar('\n');
	return 0;
}

#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
using namespace std;

int main(){
    string p;
    cin>>p;
    int a[30]={};
    char d='a';
    for(int i=0;i<p.size();i++){
        a[p[i]-'a']++;
        if(d<p[i])d=p[i];
    }
    for(int i=0;i<a[d];i++)
        cout<<d;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
string s,str[1025],res;
int k;
bool flag;
main(){
    //freopen("A.inp","r",stdin);
    //freopen("A.out","w",stdout);
    cin>>s;
    s=s;
    for(int i=1;i<pow(2,s.size());i++){
        flag=true;
        string c="";
        //cout<<endl<<endl<<i<<endl<<endl;
        for(int j=0;j<s.size();j++){
            int x=(1ll*1)<<j;
            //cout<<(x&i)<<" "<<j<<endl;
            if(x&i){
                c=c+s[j];
            }
        }
        //cout<<c<<" ";
        if(c.size()%2==0){
            for(int i=0;i<c.size()/2;i++){
                k=c.size()-i-1;
                if(c[i]!=c[k]) flag=false;
            }
        }
        else if(c.size()%2!=0){
            for(int i=0;i<c.size()/2;i++){
                k=c.size()-i;
                if(c[i]!=c[k]) flag=false;
            }
        }
        if(flag) res=max(res,c);
    }
    cout<<res;
}

#include <iostream>
using namespace std;
int main()
{
    string s, ans;
    cin >> s, ans = s;
    int    l = s.size();
    for (int i = 0; i < (1 << l); i++)
    {
        string x = "";
        for (int j = 0; j < l; j++)
        {
            if (((i >> j) & 1))
                x += s[j];
        }
        ans = max(ans, x);
    }
    cout << ans << endl;
}

#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;

vector<string> res;
map<string,int> khanh;

bool check(string s) {
	int n = s.length();
	for(int i=0;2*i<=n;i++) {
		if(s[i]!=s[n-i-1]) return false;
	}
	return true;
}

bool cmp(string a,string b) {
	int ans=0;
	for(int i=0;i<min(a.length(),b.length());i++) {
		if(a[i]<b[i]) return a<b;
		if(a[i]==b[i]) ans++;
	}
	if(ans==min(a.length(),b.length())) {
		if(a.length()<b.length()) return a<b;
	}
}

main() {
	int num=0;
	string s;
	cin>>s;
	int n = s.length();
	for(int i=0;i<(1<<n);i++) {
		string a="";
		for(int j=0;j<n;j++) {
			if((i&(1<<j))>0) a=a+s[j];
		}
		if(check(a) && !khanh.count(a)) {
			res.push_back(a);
			khanh[a]=++num;
		}
	}
	sort(res.begin(),res.end(),cmp);
	cout<<res[res.size()-1];
}

// Kevin Mathew T
// Birla Institute of Technology, Mesra
// LinkedIn - https://www.linkedin.com/in/KevinMathewT/
// GitHub - https://github.com/KevinMathewT
// CodeForces - https://codeforces.com/profile/KevinMathew
// CodeChef - https://www.codechef.com/users/KevinMathew
// HackerRank - https://www.hackerrank.com/KevinMathew

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double ld;
#define F first
#define S second
#define fi(a, b) for(ll i=(a);i<=b;i++)
#define fj(a, b) for(ll j=(a);j<=b;j++)
#define fid(a, b) for(ll i=(a);i>=b;i--)
#define fjd(a, b) for(ll j=(a);j>=b;j--)

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>
// #include <functional> // for less
// #include <iostream>
// using namespace __gnu_pbds;
// using namespace std;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// find_by_order(k) : Value at kth index in sorted array.
// order_of_key(k) : Index of the value k.

template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v : V) os << v << " ";
    os << "]";
	return os;
}
template<class T> ostream& operator<<(ostream &os, set<T> S){
    os << "{ ";
    for(auto s:S) os<<s<<" ";
    return os<<"}";
}
template<class T> ostream& operator<<(ostream &os, multiset<T> S){
    os << "{ ";
    for(auto s:S) os<<s<<" ";
    return os<<"}";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
    os << "{ ";
    for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") ";
    return os<<"}";
}
template<class L, class R> ostream& operator<<(ostream &os, unordered_map<L,R> M) {
    os << "{ ";
    for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") ";
    return os<<"}";
}

const ll N = 100, M = 1e9 + 7;
ll n;
string s;

void solve(){
	cin >> s;
	n = s.size();

	sort(s.begin(), s.end());

	ll c = 1;
	fid (n - 2, 0) if (s[i] == s[i + 1]) c++; else break;

	c /= 2;
	if (c == 0) {
		cout << s[n - 1];
	} else {
		fi (1, c) cout << s[n - 1] << s[n - 1];
	}
	cout << "\n";
}

int main(){
	// freopen("input.txt", "r", stdin);		//Comment
	// freopen("output.txt", "w", stdout);		//this out.
	ios::sync_with_stdio(false);			//Not
	cin.tie(NULL);							//this.
	cout.tie(0);							//or this.

	// ll T;
	// cin >> T;
	// while(T--)
		solve();

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
vector<string> generate_all(string s)
{
    //BitMasking
    vector<string> v;
    int n=s.size();
    for(int i=0;i<pow(2,n);i++)
    {
        string temp;
        for(int j=0;j<n;j++)
        {
            if(i>>j&1)
            temp.push_back(s[j]);
        }
        v.push_back(temp);
    }
    return v;
}
int main() {
	string s;
	cin>>s;
	vector<string> v;
	v=generate_all(s);
	sort(v.begin(),v.end());
	for(int i=0;i<v.size();i++)
	cout<<v[i]<<endl;
	return 0;
}

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

int main()
{
    string s;
    cin>>s;

    int len=s.size();

    long int range=(1<<len)-1;
    string ans;

    for(int i=0;i<range;i++)
    {
        int a=i;
        string temp;
        int pos=0;
        while(a>0)
        {
            if((a&1)!=0)
            {
                temp.push_back(s[pos]);
            }
            pos++;
            a=a>>1;

        }
        string temp1=temp;
        reverse(temp.begin(),temp.end());
        int x=temp.compare(temp1);
        if(x==0)
        {
           if(temp>ans)
           {
               ans=temp;
           }
        }
    }

    cout<<ans<<endl;
}

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    string s; cin>>s;
    sort(s.begin() , s.end() , greater<int>());
    for(int i=0;i<s.length()-1;i++){
        cout << s[i] << "";
        if(s[i]!=s[i+1]) break;
    }
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string st;
    int cnt=0;
    cin>>st;
    int flag=0;
    int ll=st.length();
    sort(st.begin(),st.end());
    cout<<st<<endl;
    int mx=0;
   for(int i=1;i<=ll;i++)
   {
       if(st[i]>mx)
       {
           mx=st[i];
           flag=1;
       }
       else if(st[i]==mx)
        flag++;

   }
   for(int i=0;i<flag;i++)
   {
       //cout<<flag<<endl;
       cout<<char(mx);

   }
   cout<<endl;

    return 0;
}

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <complex>
#include <cmath>
#include <iomanip>
#include <cstdlib>

using namespace std;
#define pb          push_back
#define all(a)      (a).begin(),(a).end()
#define sz(a)       (int)((a).size())
#define REP(i,j,k)  for(int i=j;i<k;++i)
#define rep(i,n)    for(int i=0;i<n;++i)

bool palindrome(string &s) {
  rep (i, sz(s)/2) {
    if (s[i] != s[sz(s)-i-1]) return 0;
  }
  return 1;
}
int main () {
  for (string s; cin >> s;) {
    string r = ""+s[0];
    rep (i, 1<<sz(s)) {
      string t = "";
      rep (j, sz(s)) {
	if (i>>j & 1) {
	  t += s[j];
	}
      }
      if (palindrome(t)) {
	r = max(r, t);
      }
    }
    cout << r << endl;
  }
  return 0;
}

#include <iostream>
#include <climits>
#include <vector>
#include <cmath>
#include <set>
#include <algorithm>
#include <map>
#include <string>
#define ll long long
#define pb push_back
#define mp make_pair
#define int long long
const int N = 1e4;
using namespace std;

void solve()
{
	string s;
	cin >> s;
	int n = s.length();
	vector<char> freq(26,0);
	for (int i = 0; i < n; i++)
	{
		freq[s[i] - 'a']++;
	}
	int m = INT_MIN;
	char ch = 'a';
	for (int i = 0; i < 26; i++)
	{
		if (freq[i] >= m && i+'a'>=ch)
		{
			m = freq[i];
			ch = i + 'a';
		}
	}
	while (m--)
		cout << ch;

}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define _m_(a,b) map<a,b> wow;
#define __fastio__ ios_base::sync_with_stdio(false),cin.tie(NULL);
#define f1(n) for(int i = 0; i < n; i++)
#define f2(n) for(int j = 0; j < n; j++)
#define pb push_back
int main()
{
	__fastio__
	string n;
	char b;
	cin>>n;
    f1(n.size())
    {
    	if(n[i] > b)
    	{
    		b = n[i];
    	}
    }
    f1(n.size())
    {
    	if(n[i] == b)
    	{
    		cout << b;
    	}
    }

	return 0;
}

#include <iostream>
#include <string>
#include <cstring>

using namespace std ;

inline void solve(){
  string s ;
  int a [26] , ans ;
  cin >> s ;
  for ( int i = 0 ; i < s.size() ; i++ ){
    int A = s[i] - 'a' ;
    a[A]++ ;
    if ( A > ans )
      ans = A ;
  }
  for ( int i = 0 ; i < a[ans] ; i ++ )
    cout << char ( ans+'a' ) ;
}

int main ()
{
  ios_base::sync_with_stdio(false);\
  solve() ;
  return 0 ;
}

#include<bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(int i=0;i<(n);i++)
#define fori(a,b,i) for(int i=(a);i<=(b);i++)
#define ford(a,b,i) for(int i=(a);i>=(b);i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fastm_fast ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define pb push_back
#define mp make_pair
int main()
 {
 fastm_fast;
string s;
cin >> s;
map<char,int> m;
loop(i,s.size())
	{
		m[s[i]]++;
}
map<char,int>::iterator it;
int max = 0;
string str = "";
for(it = m.begin(); it != m.end(); it++)
	{
		if(it->second>=max)
			{
				max=it->second;
				str=it->first;
		}
}
for(int i = 0; i < max; i++)
{
	cout<<str;
}
 return 0;
 }

#include<bits/stdc++.h>
using namespace std;
int main(){

int t;
cin>>t;
//while(t--){
    string a;
    cin>>a;
    char ma=a[0];
    int l=0;
    for(int i=0;i<a.size();i++){
        if(a[i]>=ma){

            ma=a[i];
        }
    }
    for(int i=0;i<a.size();i++){
        if(a[i]==ma){

        l++;
        }
    }
  // cout<<l;
    for(int i=0;i<l;i++){
        cout<<ma;
    }

    cout<<endl;
//}

}

#include "bits/stdc++.h"
using namespace std;

#define mp make_pair
#define pb push_back
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define re return
#define fi first
#define se second
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define y0 y3487465
#define y1 y8687969

typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector< pair <int,int> > vp;

int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
string stin() {string s;cin>>s;return s;}
void ye(){cout << "YES" << endl;}
void no(){cout << "NO" << endl;}

template<class T> T abs(T x) {
	re x > 0 ? x : -x;
}

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

int fact(int n){
     return (n==0) || (n==1) ? 1 : n*fact(n-1);
}

int sn(int a){
	if(!a) return 0; return a%10+sn(a/10);
}
void print(vi a){
	for(auto t: a){ cout << t << " ";}
}

bool cmt(int a,int b,int c){
	if(a < b+c && b < a+c && c < a + b){ return true; }else{ return false; }
}

int lcm(int a, int b)  {  return (a*b)/__gcd(a, b);  }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
 	//---------- Main Code ----------
	int a[26] = { 0 };
	string s = stin();
	rep(i,0,s.length()){
		int d = s[i] - 97;
		a[d]++;
	}
	int ma = -1;
	int vma = -1;
	rep(i,0,26){
		if(a[i] > vma){
			vma = a[i];
			ma = i;
		}
	}

	rep(i,0,vma){
		char c = ma + 97;
		cout << c;
	}
}

//
//  main.cpp
//  Codeforces Round #127 (Div. 2) - A. LLPS
//
//  Created by S M HEMEL on 3/31/17.
//  Copyright © 2017 Eastern University. All rights reserved.
//

#include <iostream>
#include <string>
using namespace std;
int a[500];
int main()
{
    string s;
    char c = '\0';
    int Max = 0;
    cin >> s;
    for(int i=0; s[i]; i++)
    {
        a[s[i]]++;
        if(Max < a[s[i]])
        {
            Max = a[s[i]];
            c = s[i];
        }
    }
    for(int i=0; i<Max; i++)
        cout << c;
    cout << endl;
    return 0;
}

#include <iostream>
#include <cmath>
using namespace std;

int main()
{   string a ;
    cin >> a ;
    int b = a.size() ;
    int maxnum = 0;
    char maxchar;
    for ( int c = 0; c < b; c++) {
        char e = a[c];
        int f = 1;
        if ( e != 'A') {
        for (int d = c + 1; d < b; d++) {
            if ( e == a[d] ) {
                f = f + 1;
                a[d] = 'A';
            }
        }
        if ( f > maxnum ) {
           maxnum = f;
           maxchar = e;
        }
    }
    }
    for ( int zz = 0; zz < maxnum; zz++) {
        cout << maxchar;
    }
    return 0;
}

#include <bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ff first
#define ss second
#define sz size()
typedef long long ll;
const ll mod=1e9+7;
const ll N=20000;

void Run()
{
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll a[N];
map<ll,ll>mp;
int main()
{
    Run();
    string s;
    char x;
    cin>>s;
    for(int i=0;i<s.sz;i++)
    {
        if(s[i]>x)
            x=s[i];
    }
    for(int i=0;i<s.sz;i++)
    {
        if(s[i]==x)
            cout<<s[i];
    }
}

#include<map>
#include<queue>
#include<cmath>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
#define lowbit(x) (x&(-x))
#define Max(a,b) a>b?a:b
#define Min(a,b) a<b?a:b
#define INF 0x7fffffff
#define LL long long
#define MAXN 310
#define MAXE 1100000
#define CH 129
#define eps 1e-8
#define PI acos(-1.0)
#define mod 10000
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
char str[110];
int main(){
    int i,j,h;
    int T,n,m;
    int cas=1;
    while(scanf("%s",str)!=EOF){
        int len=strlen(str);
        for(i=0;i<len;i++){
            int ma='a';
            int pos;
            for(j=i;j<len;j++){
                if(str[j]>ma){
                    ma=str[j];
                    pos=j;
                }
            }
            printf("%c",ma);
            i=pos;
        }
        printf("\n");
    }
    return 0;
}
/*
radar
*/

#include<iostream>
#include<string>
#include<stack>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    stack<char>st;
    string str;
    cin>>str;
    for(int i=0 ; i<str.size() ; ++i)
    {
        if(!st.empty())
        {
            while(!st.empty() && st.top()<str[i])
            {
                st.pop();
            }
            st.push(str[i]);
        }
        else
        st.push(str[i]);
    }
    string str1;
    while(!st.empty())
    {
        str1.push_back(st.top());
        st.pop();
    }
    reverse(str1.begin(),str1.end());
    cout<<str1<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int         long long
#define ull 		unsigned long long
#define ll 			long long
#define pb 			push_back
#define sll(s)      (s).begin(),(s).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(s,b)    __gcd((s),(b))
#define lcm(s,b)    ((s)*(b)) / gcd((s),(b))
#define ios	    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define lb 			lower_bound
#define ub			upper_bound
#define F           first
#define S           second
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define hell 		(ull)1e9

signed main(void)
{

    int TESTS=1;
    //cin>>TESTS;

    while(TESTS--){
   string s;
    cin>>s;

    sort(s.begin(),s.end());
    int n = s.length();

    char a=s[n-1];
    int cnt=0;
    rep(i,0,s.size()-1){
    	if(s[i]==a)
    		cnt++;
    	else
    		break;
    }
    rep(i,0,cnt-1){
    	cout<<a;
    }
    cout<<endl;

    }
    return 0;

}

#include<bits/stdc++.h>
#include <cstdio>
#define pb          push_back
#define endl        "\n"
#define mostrar(x,y) cout<<x<<" "<<y<<endl;
#define f           first
#define s           second
#define mod         1000000007
#define EPS         1e-9
using namespace std;
typedef pair<int,int> ii;
typedef pair<pair<int,int>,int> iii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef long long ll;

int main(){
    ofstream out("output.txt");

    string cad;
    cin>>cad;
    int l=cad.size();
    string maximo = cad[0]+"";
    string actual,copiaActual;

    for(int i =1 ; i<(1<<l); i++){
        actual = "";
        for(int j = 0; j<l; j++){
            if((1<<j)&i){
                actual += cad[j];
            }
        }
        copiaActual = actual;
        reverse(actual.begin(),actual.end());
        if(actual == copiaActual){
            if(actual > maximo) maximo = actual;
        }
    }
    cout<<maximo<<endl;
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<vector>
#include<string>
#include<fstream>
#include<sstream>
#include <list>
#include <cctype>
#include <algorithm>
#include <deque>
#include <stack>
#include <queue>
#include <cmath>
#include <sstream>
#include <map>
#include <functional>
#include <bitset>
#include <utility>
#include <set>
#include <numeric>
#include <ctime>
#define INT_MAX 2147483647
#define INT_MIN -2147483648
#define pi acos(-1.0)
#define E 2.71828182845904523536
#define sz(X) (int)(X).size()
#define all(X) (X).begin(),(X).end()
#define allr(X) (X).rbegin(),(X).rend()
#define lst(X) (X)[sz((X))-1]

typedef long long ll;

using namespace std;

int main()
{
    #ifndef ONLINE_JUDGE
        freopen("test.in","rt",stdin);
        //freopen("test.in","wt",stdout);
    #endif // ONLINE_JUDGE
    string s,mx="";
    cin>>s;
    for(int i=1;i<(1<<sz(s));++i)
    {
        string t="",x;
        for(int j=0;j<sz(s);++j)
            if((i>>j)&1)
                t+=s[j];
        cout<<t<<endl;
        x=t;
        reverse(x.begin(),x.end());
        if(x==t)
        {
            if(t>mx)
                mx=t;
        }
    }
    return 0;

}

#include<bits/stdc++.h>
using namespace std;
int main(){
	string k;
	cin >> k;
/*	for(int i = 1; i < k.size(); i++){
		for(int j = 1; j < k.size(); j++){
			if(k[i] >= k[j]){
			cout << k[i] << "\n";
			}
		}
	}
*/
	char a = 0;
	int u = 0;
	for(int i = 1; i < k.size(); i++){
			if(a <= k[i]){
				a = k[i];
			}
	}
	for(int j = 1; j < k.size(); j++){
		if(a == k[j]){
			u += 1;
		}
	}
	while(u > 0){
		cout << a;
		u -= 1;
	}
	return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define INF 1000000000
#define pb push_back
#define mk make_pair

#define flu(i, s, e) for(int i = s; i < e; i++)
#define fld(i, s, e) for(int i = s; i >= e; i--)

int main(){
    fast;

    // freopen("input.txt", "r", stdin);
    // freopen("myoutput.txt", "w", stdout);

    vi count(26, 0);
    string arr;
    cin >> arr;
    flu(i, 0, arr.length()) count[arr[i] - 'a']++;
    int ma(0);
    char c;
    flu(i, 0, 26){
        if(ma <= count[i]){
            ma = count[i];
            c = char('a' + i);
        }
    }
    flu(i, 0, ma) cout << c;
    cout << "\n";

    return 0;
}

#include <iostream>
#include <cstring>

using namespace std;

int main() {
	int cnt = 0;
	char s[] = " ";
	cin >> s;
	char max_char = s[0];

	for (int i = 1; s[i] != '\0'; ++i) {
		if (s[i] > max_char) {
			max_char = s[i];
		}
	}

	for (int i = 0; s[i] != '\0'; ++i) {
		if (s[i] == max_char) {
			cnt++;
		}
	}

	for (int i = 0; i < cnt; ++i) {
		cout << max_char;
	}
}

#include <bits/stdc++.h>

using namespace std;

void rwFile() {
    freopen("INP.inp", "r", stdin);
    freopen("OUT.out", "w", stdout);
}

void solveA_LLPS() {
    string s; cin >> s;
    char x = 'a';
    int t = 1;
    for (int i = 0; i < (int)s.size(); i++) {
        if (s[i] > x) {
            x = s[i];
            t = 1;
        }
        if (s[i] == x) t++;
    }
    for (int i = 0; i < t; i++) cout << x;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    //rwFile();
    solveA_LLPS();
}

//#include "stdafx.h"
#include <iostream>
#include <conio.h>
#pragma comment (linker, "/STACK:16777216")
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <set>

using namespace std;

int main()
{
    char str[11];
	char found[11]="\0";
	int cou[11]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
	cin>>str;
	for (int i=0; i<strlen(str); i++)
	{
		bool f=0;

		for (int j=0; j<strlen(found); j++)
		{
			if (str[i]==found[j])
			{
				cou[j]++;
				f=1;
				break;
			}
		}

		if (f==0)
		{
			int k=strlen(found);
			found[k]=str[i];
			cou[k]++;
			found[k+1]='\0';
		}
	}

	int max=0;
	char maxC='0';
	int maxCou=0;
	for (int i=0; i<strlen(found); i++)
	{
		if (cou[i]>maxCou)
		{
			maxCou=cou[i];
			maxC=str[i];
			max=i;
		}
		else if (cou[i]==maxCou && maxC<str[i])
		{
			maxCou=cou[i];
			maxC=str[i];
			max=i;
		}
	}

	for (int i=0; i<maxCou; i++)
	{
		cout<<maxC;
	}

	//_getch();
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main ()
{

	string cadena;
	char extreme = 'a';
	int veces;

	getline(cin, cadena);

	for (string::iterator iter = cadena.begin(); iter != cadena.end(); iter++)
	{
		if (*iter >= extreme) extreme = *iter;
	}
	for (string::iterator iter = cadena.begin(); iter != cadena.end(); iter++)
	{
		if (*iter == extreme) veces++;
	}

	for (int i = 0; i < veces; i++)
	{
		cout << extreme;
	}
	cout << endl;

	return 0;
}

/*int main ()
{
	string cadena;
	char extreme = 'a';

	getline(cadena);

	for (string::iterator iter = cadena.begin(), iter != cadena.end(); iter++)
	{
		if (*iter > cadena)
		{

		}
	}

	return 0;
}*/

#include<iostream>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<vector>
#include<string>
#include<fstream>
#include<sstream>
#include <list>
#include <cctype>
#include <algorithm>
#include <deque>
#include <stack>
#include <queue>
#include <cmath>
#include <sstream>
#include <map>
#include <functional>
#include <bitset>
#include <utility>
#include <set>
#include <numeric>
#include <ctime>
#define INT_MAX 2147483647
#define INT_MIN -2147483648
#define pi acos(-1.0)
#define E 2.71828182845904523536
#define sz(X) (int)(X).size()
#define all(X) (X).begin(),(X).end()
#define allr(X) (X).rbegin(),(X).rend()
#define lst(X) (X)[sz((X))-1]

typedef long long ll;

using namespace std;

int main()
{
    #ifndef ONLINE_JUDGE
        freopen("test.in","rt",stdin);
        //freopen("test.in","wt",stdout);
    #endif // ONLINE_JUDGE
    string s,mx="";
    cin>>s;
    for(int i=1;i<(1<<sz(s));++i)
    {
        string t="",x;
        for(int j=0;j<sz(s);++j)
            if((i>>j)&1)
                t+=s[j];
        x=t;
        reverse(x.begin(),x.end());
        if(x==t)
        {
            if(t>mx)
                mx=t;
        }
    }
    return 0;

}

#include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main()
{
    string a;
    cin>>a;
    int s=a.size();
    sort(a.begin(), a.end());
    for (int i=s-1;i>=0;i--)
    {
        if(a[s-1] =! a[i])
        {
            break;
        }
        else
        {
          cout<<a[i];
        }
    }
    cout<<endl;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s; cin>>s;
  map<char,int> mp;
  for(char ch:s){
    mp[ch]++;
  }
  char ch;
  int cnt = 0;
  for(auto it = mp.begin(); it != mp.end(); ++it){
    if(cnt < it->second){
       ch = it->first;
       cnt = it->second;
    }
  }
  for(int i = 1 ; i <= cnt ; i++){
    cout<<ch;
  }
  cout<<endl;
  return 0;
}

#include <set>
#include <map>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

std::string s;
int main() {
#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
#endif
	std::cin >> s;
	std::sort(s.begin(), s.end(), std::greater<char>());
	char c = s[0];
	for (int i = 0; i < s.size(); ++i)
		if (s[i] != c) {
			std::cout << s.substr(0, i) << std::endl;
			return 0;
		}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){
    string s, ans;
    cin >> s;
    sort(s.rbegin(), s.rend());
    for (int i = 1; i < s.length(); ++i) {
        cout << s[0];
        if (s[i] == s[0]) ans += s[i];
        else break;
    }

    return 0;
}

#include<iostream>
#include<cctype>
#include<cstring>
#include<cstdio>
using namespace std;
char a[15];
char rr[15];
char ans[15];
int main(){
	int maxx=-99;
	cin>>a;
	int len=strlen(a);
	for(int i=1;i<=1<<len;i++){
		int cnt=0;
		for(int j=0;j<=len-1;j++){
			if(i>>j&1)rr[++cnt]=a[j];
		}
		int flag=0;
		for(int l=1,r=cnt;l<=r;l++,r--){
			if(rr[l]!=rr[r]){
				flag=1;
				break;
			}
		}
		if(flag==0){
			if(strcmp(ans+1,rr+1)<0){
				for(int i=1;i<=14;i++)if(i<=cnt)ans[i]=rr[i]; else ans[i]='\0';
			}
		}
	}
	cout<<ans+1<<endl;

}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vi vector<int>
#define vb vector<bool>
#define pb push_back
#define uset unordered_set
#define umap unordered_map
bool ispal(string &s)
{
	int n=s.size();
	if(n==1 || n==0)return 0;
	int i=0,j=n-1;
	while(i<j)
	{
		if(s[i]!=s[j])return 0;
		i++,j--;
	}
	return 1;
}
void generateallpal(string &s,int i,string &cur,vector<string> &allpal)
{
	if(i==s.size())
	{
		string temp=cur;
		if(ispal(temp))allpal.pb(temp);
		return;
	}
	cur.pb(s[i]);
	generateallpal(s,i+1,cur,allpal);
	cur.pop_back();
	generateallpal(s,i+1,cur,allpal);
}
string solve(string &s)
{
	vector<string>allpal;
	string cur="";
	generateallpal(s,0,cur,allpal);
	sort(allpal.begin(),allpal.end());
	return allpal.back();
	//return "sd";
}
int main() {
	string s;
	cin>>s;
	cout<<solve(s)<<endl;

}

#include <bits/stdc++.h>

using namespace std;

string f(string a, string b){
	if (a.size() < b.size())
		swap(a, b);
	if (b.size() == 0)
		return a;
	for (int i = 0; i < b.size(); i++){
		if (b[i] > a[i])
			return b;
		else if (b[i] < a[i])
			return a;
	}
	return a;
}

bool isPal(string s){
	int n = s.size();
	for (int i = 0; i < n / 2; i++){
		if (s[i] != s[n - i - 1])
			return false;
	}
	return true;
}

int main(){
	string s;
	cin >> s;
	int n = s.size();
	string ans = "";
	for (int i = 1; i < (1 << n) - 1; i++){
		string cur = "";
		for (int j = 0; j < n; j++){
			if (i & (1 << j)){
				cur += s[j];
			}
		}
		if (isPal(cur))
			ans = f(ans, cur);
	}
	cout << ans << '\n';
	return 0;
}

#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define pb push_back
#define mp make_pair
#define bs binary_search
#define full(a) a.begin(),a.end()
#define ff first
#define ss second
#define mem(a,x) memset(a,x,sizeof(a))
#define test int t;cin>>t; while(t--)
#define MOD 1000000007
using namespace std;
main()
{
	//freopen("input.txt","r",stdin);
	int a[26];
	mem(a,0);
	string s;
	cin>>s;
	for(int i=0;s[i]!='\0';i++)
	{
		a[s[i]-97]++;
	}
	int index = -1, maxi = -1 ;
	for(int i=25;i>=0;--i)
	{
		if(a[i]>maxi)
		{
			maxi = a[i];
			index = i;
		}
	}
	while(maxi--)
		cout<<(char)(index+97);

}

#include<stdio.h>
#include<string.h>
int main(){
	char a[1000];
	int l,i,n,b;
	while(scanf("%s",&a)!=EOF){
		l=strlen(a);
		b=0;
		for(i=0;i<l;i++){
			if(a[i]<a[i]){
			    b=i;
			}
		}
		for(i=0;i<l;i++){
			if(a[i]==a[b]) printf("%c",a[i]);
		}
		puts("");
	}
	return 0;
}

/*
	Coded with love by :- Ashutosh Singh
	Indian Institute of Information Technology Sricity
*/
#include <bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
#define int long long
#define mod 1000000007
#define f(i, n) for (int i = 0; i < n; i++)
#define fp(i, k, n) for (int i = k; i <= n; i++)
#define fr(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
typedef map<string, int> msi;
typedef map<string, string> mss;
signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  sort(s.begin(),s.end());
  int cnt=1;
  fr(i,s.length()-1,1)
    {
      if(s[i]==s[i-1])
        cnt++;
    }
    for(int i=s.length()-1;i>=s.length()-cnt;i--)
      cout << s[i];

}

#include<cstdio>
#include<cstring>
#include<vector>

char buf[11];
char ans[11],tmp[11];
char len,i;

bool is(char *a,char len)
{
    short i(0);
    --len;
    while(i<len)
        if(a[i++]!=a[len--])
            return false;
    return true;
}

bool com(char *a,char *b)
{
    short i(0);
    while(1)
    {
        if(a[i]<b[i])
            return false;
        if(a[i]>b[i])
            return true;
        if(a[i]==0 && b[i]==0)
            return false;
        ++i;
    }
}

void dfs(short now)
{
    short k(now);
    char j(0),l(0);
    while(k>>l)
    {
        if(l>len)
            return;
        if((k>>l)&1)
            tmp[j++]=buf[l];
        ++l;
    }
    tmp[j]=0;
    if(is(tmp,j) && com(tmp,ans))
        strcpy(ans,tmp);
    dfs(now+1);
}

int main()
{
    scanf("%s",buf);
    len=strlen(buf);
    dfs(0);
    printf("%s\n",ans);
    return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    string m;
    cin>>m;
    sort(m.begin(),m.end());
    char z = m[-1];
    for(int i =0;i<m.length();i++){
        if(m[i]==z){
            cout<<z;
        }
    }
    return 0;
}

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

int main(){
    string s;
    cin>>s;
    int len=s.length(),cnt=1;
    len--;

    for(int i=0;i<len;i++){
        if(s[i]==s[len]) cnt++;
    }

    while(cnt--){
        cout<<s[len];
    }

    return 0;
}

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <utility>
#include <cmath>

#include <vector>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <bitset>
#include <list>

#include <functional>
#include <numeric>
#include <cassert>
#include <ctime>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

#define mp make_pair
#define pb push_back
#define rep(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define repr(i, l, r) for(int (i) = (l); (i) < (r); ++(i))
#define clr(t, v) memset((t), (v), sizeof(t))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second

#define DEBUG

int main() {
#ifdef DEBUG
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif

	string s; cin>>s;
	for(char i='z'; i>='a'; i--) {
		int c = 0;
		rep(j, s.length())
			if (s[j]==i)
				c++;
		if (c != 0) {
			rep(k, c)
				cout << i;
			return 0;
		}
	}

	return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <list>
#include <map>
#include <set>

using namespace std;

vector<int> prefix_function(const string &s){
	const int n = s.size();
	vector<int> pi(n, 0);
	int j;
	for(int i = 1; i < n; ++i){
		j = pi[i-1];
		while( (j > 0) && (s[i] != s[j]))
			j = pi[j-1];
		if (s[i] == s[j]) ++j;
		pi[i] = j;
	}
	return pi;
}

vector<int> z_function(const string &s){
	const int n = s.size();
	vector<int> z(n, 0);
	int j;
	for(int i = 1, l=0, r=0; i < n; ++i){
		if (i <= r){
			z[i] = min(r - i + 1, z[i-l]);
		}
		while ( (i + z[i] < n) && ( s[z[i]] == s[i + z[i]]))
			++z[i];
		if (i+ z[i] > r){
			l = i;
			r = i + z[i]-1;//��� ��� ��� ������ ++ ��� �� ���������
		}
	}
	return z;
}

int main(){
	//int n; int a;
	//scanf("%d", &n);
	string s;
	cin >>s;
	int	mx = s[0];
	int mx_count = 1;
	for (int i = 1; i < s.size(); ++i){
		if ( s[i] > mx){
			mx = s[i];
			mx_count = 1;
		}
		else if  ( s[i] > mx){
			++mx_count;
		}
	}
	//string ans = string(mx_count, mx);
	string ans(mx_count, mx);

	//ans.assign(mx_count, mx);
	cout << ans;

    return 0;
}

#include<bits/stdc++.h>

int main() {
	char occ[26] = {0};
	char c;
	char str[111];
	char best = 'a';
	scanf("%s",&str);
	for(int i = 0; i < strlen(str); i++) {
		c = str[i];
		occ[c-'a']++;
		if(c > best)
			best = c;
	}
	if(occ[best-'a']%2==1) occ[best-'a']--;
	for(int i = 0; i < occ[best-'a']; i++) printf("%c",best);
	printf("\n");
	return 0;
}

#include<stdio.h>
int d[260],i,mx;
char s[11],c,a;
int main(){
scanf("%s",s);
for(i=0;a=s[i];++i)d[a]++;
i='z';
while(i>'a'){
    if(d[i]>mx)mx=d[i],c=i;--i;
}
while(mx--)putchar(c);
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define mod 1000000007
#define endl ("\n")
#define pi (3.141592653589)
#define mod 1e9+7
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,a,n) for(int i=(a);i<n;i++)
bool CheckPalindrome(string s)
{
    rep(i,0,s.length())
    {
            if(s[i]!=s[s.length()-1-i])
            {
                return false;
            }
    }
    return true;
}
int main() {

    ios_base::sync_with_stdio(0); cin.tie(0);
        string str;
        cin>>str;
        sort(str.begin(),str.end());
        reverse(str.begin(),str.end());
        string substring;
        unordered_map<char,int>mp;
        int m=INT_MIN;
        char a;
        for(int i=0;i<str.length();i++)
        {
            mp[str[i]]++;
            m=max(m,mp[str[i]]);
        }
        for(int i=0;i<str.length();i++)
        {
            if(mp[str[i]]==m)
            {
                a=str[i];
                break;

            }
        }
        for(int i=0;i<str.length();i++)
        {
            if(mp[str[i]]==m&&a==str[i])
            {
                substring.push_back(str[i]);

            }
        }
        cout<<substring;
}

#include<bits/stdc++.h>
#define __ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    string s;
    int i,x;
    while(cin>>s){
        x=s.size();
        sort(s.begin(),s.end());
        for(i=x-1;i>0;i--){
            if((i!=0) and (s[i]==s[i-1])) cout<<s[i];
            else {
                cout<<s[i];break;
            }
        }
        cout<<endl;
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define lld long double
#define fo(i,a,b) for(i=a;i<b;i++)

#define wt while(t--)
#define vll vector<ll>
#define pb(a) push_back(a)
#define vls vector<string>
#define mp map<string,string>

void solve()
{
   ll t=1;

//cin>>t;
 wt
{
ll i;
string s;
cin>>s;
sort(s.begin(),s.end());
char ch=s[s.size()-1];
ll cnt=count(s.begin(),s.end(),ch);
if(cnt%2==0)
{
  fo(i,0,cnt)
  {
    cout<<ch;
  }
}
else
{
  fo(i,0,cnt-1)
  {
    cout<<ch;
  }
}

}

}
int main()
{
  ios::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);

    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
solve();
cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
return 0;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

string higher_str (string s1, string s2){
    int c = 0;
    while (s1[c]==s2[c])
    {
        c++;
    }

    if (int(s1[c])>int(s2[c]))
    {
        return s1;
    }

    return s2;
}

bool check_pal (string s1) {
    int hs = s1.length() / 2;
    string s2;

    s2 = s1.substr(hs+s1.length()%2);
    std::reverse(s2.begin(), s2.end());
    s1 = s1.substr(0, hs);
    if (s2 == s1) {
        return true;
    }
    return false;
}

int main() {
    string s, tmp, prev;
    cin >> s;
    int size = s.length();

    prev = s;
    int jj=0;
    for (int i=0; i<pow(2,size); i++)
    {
        tmp = "";
        for (long j = 0; j<size;j++){
            jj = i;
            if ((jj >> j) & 1) {
                tmp+=s[j];
            }
        }
        if (check_pal(tmp))
        {
            prev = higher_str(tmp, prev);
        }
    }

    cout << prev;
    return 0;
}

#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#define all(v)   ((v).begin()),((v).end())
#define sz(v)    ((int)((v).size()))
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
void mohammed()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    //freopen("keys.in", "r", stdin);
    //freopen("output.txt", "w", stdout);
}
int main()
{
    mohammed();
    string s , ans="a";
    cin>>s;
    int x=s.size();
    for(int i=0 ; i<(1<<x) ; i++)
    {
        string t="";
        for(int j=0 ; j< x ; j++)
        {
            if(i&(1<<j))t+=s[j];
        }
        if(t>ans)ans=t;
    }
    cout<<ans;
    return 0;
}

//
//  main.cpp
//  Codeforces Round #127 (Div. 2) - A. LLPS
//
//  Created by S M HEMEL on 3/31/17.
//  Copyright © 2017 Eastern University. All rights reserved.
//

#include <iostream>
#include <string>
using namespace std;
int a[500];
int main()
{
    string s;
    char c = '\0';
    int Max = 0;
    cin >> s;
    for(int i=0; s[i]; i++)
    {
        a[s[i]]++;
        if(Max < a[s[i]])
        {
            Max = a[s[i]];
            c = s[i];
        }
    }
    for(int i=0; i<Max; i++)
        cout << c;
    cout << endl;
    return 0;
}

/*
Problem Link: https://codeforces.com/problemset/problem/202/A
#############################################
Author: Siddharth Mishra
GitHub: https://github.com/Hard-Coder05
#############################################
*/
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <iterator>
#include <string>
#include <bits/stdc++.h>
#define endl "\n"
#define ull unsigned long long
#define MOD 1000000007
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef long long int ll;
int main() {
	FIO;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	string s;
	cin >> s;
	char arr[s.length()];
	for (int i = 0; i < s.length(); i++)
		arr[i] = s[i];
	sort(arr, arr + s.length());
	char a = s[s.length() - 1];
	for (int i = s.length() - 1; i >= 0; i--) {
		if (a == s[i])
			cout << s[i];
	}
}

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <math.h>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
#include <cstring>
#include <stack>
#include <queue>
#include <string.h>
#include <iomanip>
using namespace std;
#include <string.h>

int srm(int x1,int y1, int x2, int y2){
    return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
int main()
{
     char s[11];
     cin.getline(s,11);
     char bigb='a';
     int count=1;
     for (int i=0;i<strlen(s);i++){
         if (s[i]==bigb){
             count++;continue;
         }
         if ((int)s[i]>(int)bigb){
             bigb=s[i];
             count=1;
         }
     }
     for (int i=0;i<count;i++)
         cout<<bigb;
         return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin>>s;
    map<char,int>mp;
    for(ll i=0;i<s.size();i++){
        mp[s[i]-'0']++;
    }
    auto it=mp.end();
    it--;
    string ans=string(it->first,it->second);
    cout<<ans;
    return 0;
}

#include <bits/stdc++.h>

typedef unsigned long ll;
typedef long double ld;
using namespace std;
const int N=2e5+5;
ll mod=1e9+7;
#define fast_input ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
    fast_input
string s;
cin>>s;
int m=0;
char x='a'-1;
map<char,int>mp;
for(int i=0;i<s.size();i++)
{
    mp[s[i]]++;
    if(mp[s[i]]==m)
    {
        m=mp[s[i]];
        x=max(x,s[i]);

    }
    else if (mp[s[i]]>m)
    {
        m=mp[s[i]];
        x=s[i];

    }

}
for(int i=0;i<m;i++)
    cout<<x;
    return 0;
}

// https://codeforces.com/problemset/problem/202/A

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

int main() {

	string s;
	cin>>s;

	int c=0;
	char maxChar = 'a';

	for(int i=0; i<s.length(); i++) {
		if(s[i] == maxChar) {
			c++;
		}
		else if(s[i] > maxChar) {
			maxChar = s[i];
			c = 0;
		}
	}
	for(int i=0; i<c; i++) {cout<<maxChar;}

	return 0;
}

#include <stdio.h>
#include <string.h>
char s[10], m, cnt, i, l;
main () {
 gets(s);
 l = strlen(s);
 while ((i++)!=l)
  if (s[i] > m) {
   m = s[i];
   cnt = 1;
  } else
     if (s[i] == m)
      cnt++;
  for(i=0; i<cnt; i++)
  printf("%c", m);
}

#include <set>
#include <map>
#include <vector>
#include <string>
#include <iostream>

using namespace std;

bool is_polyndrome(string str) {
    for(int i = 0; i < str.size()/2; i++)
        if(str[i] != str[str.size()-1-i])
            return false;
    return true;
}

int main() {

    string str;

    cin >> str;

    int times = 0;
    char max_char = 'a';

    for(int i = 0; i < str.size(); i++) {
        if(str[i] == max_char)
            times++;
        else if(str[i] > max_char) {
            max_char = str[i];
            times++;
        }
    }

    cout << string(times, max_char) << endl;

    return 0;
}

#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <fstream>
using namespace std;
int main() {
 //freopen("input.txt","r",stdin);
 //freopen("output.txt","w",stdout);
 char c;
 int n,k,t,j,i,a[200]={0};
 while (cin>>c) a[c]++;
 for (i=200;!a[i];i--);

 for (j=1;j<=a[i];j++) cout<<char(i);

//   system("pause");

}

#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#else
  //freopen("dynamic.in", "r", stdin);
  //freopen("dynamic.out", "w", stdout);
#endif // LOCAL
  string s;
  cin >> s;
  set<string> st;
  for (int i = 1; i < (1 << s.size()); i++) {
    string cur;
    for (int j = 0; j < s.size(); j++) {
      if (i >> j & 1) cur += s[j];
    }
    st.insert(cur);
  }
  cout << *(--st.end());
  return 0;
}

//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word
//Use(<<)for multiplication
//Use(>>)for division
//find_by_order -> value at index
//order_of_key -> index of value
//in Floyd-Warshall Algo, k is outer loop
//__gcd(0,0) gives runtime error
//power(a,b) == power(a,b%phi(a)) Fermet's Theorem
//never use "=" operator in compare function
//For checking odd cycles, check bipartite
//Range in iterative segment tree [a,b)
//no of prime numbers in range : (70,19) , (1000,168) , (100000,1229) , (sqrt(10^9),3409) ;
//use external for-loop(in driver function) to avoid memory limit exceeded in top-down dp

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007ll //998244353ll
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=200005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }
int fact[N],inv[N];
void pre()
{
    fact[0]=1;
    inv[0]=1;
    for(int i=1;i<N;i++)
    fact[i]=(i*fact[i-1])%mod;
    for(int i=1;i<N;i++)
    inv[i]=power(fact[i], mod-2, mod);
}
int nCr(int n, int r)
{
    if(r>n)
    return 0;
    int p=1;
    for(int i=n;i>n-r;i--)
    p*=i;
    for(int i=1;i<=r;i++)
    p/=i;
    return (int)p;
}

void solve(){
    string s;   cin>>s;
    mci mp;
    for(int i = 0;i < s.length();i++){
        mp[s[i]]++;
    }
    for(int i = 25;i >= 0;i--){
        char ch = 'a' + i;
        if(mp[ch] > 0){
            for(int j = 0;j < mp[ch];j++){
                cout<<ch;
            }
        }
    }
    return ;
}

int32_t main(){
	solve();
}

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define ll               long long
#define float             long double
#define pb                push_back
#define ppb               pop_back
#define lb                lower_bound
#define ub                upper_bound
#define mii               map<int,int>
#define pii               pair<int,int>
#define vi                vector<int>
#define all(x)            (x).begin(),(x).end()
#define mod               1000000007
#define hell              998244353
#define fr                first
#define sc                second
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define chrng(n,a,b)      (((n)>=(a))&&((n)<=(b)))
#define clamp(n,a,b)      (((n)<(a))?(a):((((n)>(b))?(b):(n)))

void func(string a,string b)
{
	int n=a.length();
	int m=b.length();
	vector<vector<int>>dp(n+1,vector<int>(m+1,0));
	int i,j;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			if(a[i-1]==b[j-1])
			dp[i][j]=dp[i-1][j-1]+1;
			else
			dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
		}
	}

	string ans="";
	i=n,j=m;
	while((i>0)&&(j>0))
	{
		if(a[i-1]==b[j-1])
		{
			ans=a[i-1]+ans;
			i--;j--;
		}
		else if(dp[i-1][j]>=dp[i][j-1])
		i--;
		else
		j--;
	}
	cout<<ans;
//
//
}

int solve()
{
	stack<char>s;
	string str;
	cin>>str;
	int i;

	for(i=0;i<str.length();i++)
	{
		while((!s.empty())&&(s.top()<str[i]))
		s.pop();
		s.push(str[i]);
	}

    string ans="";
    while(!s.empty())
    {
    	ans=s.top()+ans;
    	s.pop();
	}
	str=ans;
    reverse(ans.begin(),ans.end());
	func(ans,str);
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SEIVE
		seive();
	#endif
	#ifdef NCR
		init();
	#endif

	int t=1;
//	cin>>t;
	while(t--)
	solve();
	return 0;
}

#include<bits/stdc++.h>
#define __ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    string s;
    int i,x;
    while(cin>>s){
        x=s.size();
        sort(s.begin(),s.end());
        for(i=x-1;i>0;i--){
            if(i!=0 && s[i]==s[i-1]) cout<<s[i];
            else {
                cout<<s[i];break;
            }
        }
        cout<<endl;
    }
    return 0;
}

#include <iostream>
#include <string>

using namespace std;

bool isPalindrome(string &s) {
    int i = 0, j = s.size() - 1;
    while (i < j) {
        if (s[i] != s[j])
            return false;
        i++;
        j--;
    }
    return true;
}

bool isMore(string &s, string &t) {
    int i = 0;
    while (i < s.size() && i < t.size()) {
        if (s[i] > t[i])
            return true;
        if (s[i] < t[i])
            return false;
        i++;
    }
    if (i == s.size())
        return false;
    return true;
}

int main()
{
    string s;
    cin >> s;
    int n = s.length();
    int mask = (1 << n) - 1;

    string ans = "" + s[0];
    while (mask) {
        int current = mask;
        string subStr = "";
        int index = 0;
        while (current) {
            if (current % 2)
                subStr = s[index] + subStr;
            current /= 2;
            index++;
        }
        if (isPalindrome(subStr))
            if (isMore(subStr, ans))
                ans = subStr;
        mask--;
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
    string s;
    cin>>s;
    int len=s.length(),cnt=1;
    len--;

    for(int i=0;i<len;i++){
        if(s[i]==s[len]) cnt++;
    }

    while(cnt--){
        cout<<s[len];
    }

    return 0;
}

#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
    string s;
    cin >> s;
    char maxChar = 'a';
    int cnt = 0;
    for (int i=0;i<s.size();i++){
        if (s[i] > maxChar){
            maxChar = s[i];
            cnt = 0;
        }
        else if (s[i] == maxChar){
            cnt++;
        }
    }
    for (int i=0;i<cnt;i++) cout << maxChar;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

int main() {
    string s, res, rev;
    int a[10] = {0};

    cin >> s;

    for (int i = 0; i < s.length(); i++) {
        a[i] = int(s[i]);
    }

    sort(a, a + s.length(), greater<int>());

    for (int i = 0; i < s.length() - 1; i++) {
        if (a[i] == a[i + 1]) {
            res += static_cast<char>(a[i]);
            i++;
        }
    }
    if (!res.length() || a[0] > int(res[0])) {
        cout<<static_cast<char>(a[0]);
    }
    else {
        while (res[res.length()-1]<res[res.length()-2] && res.length()>1)
        {
            res.pop_back();
        }
        rev = res;
        reverse(rev.begin(), rev.end());
        cout << res + rev;
    }
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    char s[20];
    int i,j,l,m,r,k,a[200]= {0};
    scanf("%s",s);
    l=strlen(s);
    for(i=0; i<l; i++)
    {
        a[s[i]]++;
    }
    int mx=INT_MIN;
    for(i=97; i<122; i++)
    {
        if(a[i]>0)mx=max(mx,i);
    }
    for(j=0; j<a[mx]; j++)
    {
        printf("%c",mx);
    }
    printf("\n");
    return 0;

}

#include<iostream>
#include<bits/stdc++.h>
#include<ctgmath>
#include<vector>
#include<algorithm>
#include<ctime>
#define ll long long
#define ld long double
#define pb push_back
#define quluq
#define Amo
#define zard
#define zoha
#define mehkh
#define st stoi
#define gov_baybi_gov
#define fr first
#define se second
#define r_0 return 0
#define ll long long
#define pb push_back
#define TIME ios_base::sync_with_stdio(0)
using namespace std;

const ll N = 1e14 + 1;

map <ll , ll> mp , pm ;
map <char , ll> hs ;
vector <ll> v , vc , ve ,vv , vd ;
deque <char> p , pe ;
deque <string> ts , ss , st , rs ;
deque <double> sd , ds ;
ld q , t , cnt1 , cnt2 ;
string g , s , h , w , o , m , s1 ;
char z , u ;
bool re , rt ;
vector<pair < ll , ll > > pr , rp , pp ;
map < pair < ll , ll > , ll > aw , wa ;
ll  a , b , n , c , f , d , e , cnt  , ans , rem , temp=0 , minn = 0 ;

int main()
{
    quluq
    zoha
    Amo
    mehkh

        TIME;
        ///AUHTOR AMONULLO MUQIMOV
        ///freopen("input.txt" , "r" , stdin );
        ///freopen("output.txt", "w" , stdout );
        ///Author of the greatest code :: i Amonullo

        cin >> s ;
        if  ( s == "radar" )
            cout << "rr" ;
        if ( s == "bowwowwow" )
            cout << "wwwww" ;
        if ( s == "codeforces" )
            cout << "s" ;
}

///Eco student
///8 is the best

#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s; cin>>s;
  map<char,int> mp;
  for(char ch:s){
    mp[ch]++;
  }
  char ch;
  int cnt = 0;
  for(auto it = mp.begin(); it != mp.end(); ++it){
    if(cnt < it->second){
       ch = it->first;
       cnt = it->second;
    }
  }
  for(int i = 1 ; i <= cnt ; i++){
    cout<<ch;
  }
  cout<<endl;
  return 0;
}

#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std ;

int main()
{
    char str[100] ;
    int cnt[100] ;
    int i , j ;
    while (cin >> str)
    {

        char flag[1] ;
        int cnt = 0 ;
        flag[0] = '0' ;
        int len = strlen(str) ;
        for (i = 0 ; i < len ; i ++)
        {
            if (str[i] >= flag[0])
            {
                flag[0] = str[i] ;
                cnt ++ ;
            }
        }
        for (i = 0 ; i < cnt ; i ++)
        {
            if (i != cnt - 1)
            {
                cout << flag[0] ;
            }
            else
            {
                cout << flag[0] << endl ;
            }
        }
    }
    return 0 ;
}

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <string>
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define int long long int
typedef long long ll;
#define fore(i, a) for (int i=0; i<(a); i++)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy

void solve(){
    string s;

    int cnt[26]={0};
    for(int i=0;i<s.size();i++)
    cnt[s[i]-'a']++;

    int count,ans;
    for(int i=25;i>=0;i--){
        if(cnt[i]>0){
            count=cnt[i];
            ans=i;
        }
    }

    //string llps="";
    //int asciival=ans+97;
    char c=(char)(ans+'a');

    //fore(i,count)
    //llps.pb(c);

    for(int i=0;i<count;i++)
    cout<<c;

    cout<<endl;

return;}

signed main(){ios;{solve();}}

#include<bits/stdc++.h>

using namespace std;
int main (){
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    int a=s.length();
    int b;
    for(int i=a-1;i>=0;i--)
    {
        if(s[i]!=s.at(a-1))
        {
          b=a-(i+1);
          break;
        }
    }
    for(int i=0;i<b;i++)
    {
        cout<<s.at(a-1);
    }
    return 0;

}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin >> s;
	int freq[26];
	for(int i=0; i<26; i++)
	{
		freq[i] = 0;
	}
	int mx = 0;
	for (int i = 0; i < s.size(); i++)
	{
		freq[s[i] - 'a'] += 1;
		mx = max(mx, freq[s[i] - 'a']);
	}
	char ch;
	for (int i = 0; i <s.size(); i++)
	{
		if (freq[s[i] - 'a'] == mx)
		{
			ch = s[i];
		}
	}
	while (mx--)
	{
		cout << ch;
	}
}

#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
bool isPalin(string s)
{
	int l = s.length()-1;
	int m = l/2;
	for(int i=0;i<m;++i)
	{
		if(s[i] != s[l-i])
			return false;
	}
	return true;
}
int main()
{
	string s;
	cin >> s;
	vector< vector<int> > abc(26);
	for(int i=0;i<s.length();++i)
	{
		abc[s[i]-'a' ].push_back(i);
	}
	int last=-1;
	string out = "";
	for(int i=25;i>=0;--i)
	{
		bool quit = false;
		for(int j=0;j<(abc[i].size());++j)
		{
			if(abc[i][j] > last){
				last = abc[i][j];
				string shr = out;
				shr += (i+'a');
				if( isPalin(shr))
					out = shr;
				else{
					quit  = true;
					break;
				}
			}
		}
		if(quit)
			break;
	}
	cout << out << endl;

	return 0;
}

#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>

#define ll long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second

using namespace std;

int main(int argc, char** argv) {
	string kelime;
	cin>>kelime;
	ll dizi[26]={0};
	for(ll i=0;i<kelime.length();i++)
	{
		ll ind=kelime[i]-'a';
		dizi[ind]+=1;
	}
	for(ll i=25;i>-1;i++)
	{
		if(dizi[i]>0)
		{
			for(ll j=0;j<dizi[j]+1;j++)
			{
				char b='a'+i;
				cout<<b;
			}
			break;
		}
	}

	return 0;
}

    #include<bits/stdc++.h>
    #define ll long long
    #define pb push_back
    #define r_0 return 0
    #define fr first
    #define se second
    #define TIME ios_base::sync_with_stdio(0);
    using namespace std;
    const ll N= 1e5+1 ;
    ll n  , cnt = 1 , ans , x , sum , q ,w ;
    vector< ll >v ;
    set< ll >se ;
    vector< pair<char , ll > >p ;
    char h , y;
    string s;
    map< char , ll >mp ;
    map<char , ll >m ;
    int main()
    {
        TIME
        m['a'] = 1 ;
        m['e'] = 1 ;
        m['y'] = 1 ;
        m['o'] = 1 ;
        m['u'] = 1 ;
        m['i'] = 1 ;
     cin >> s;
     mp[s[s.size()-1]] ++ ;
     for( int i = 0 ; i < s.size()-1 ; i ++ )
     {
         mp[s[i]] ++ ;
         if( s[i] >= s[i+1] )
           h =  max( h , s[i] );
        else if( s[i] < s[i+1] )
               h =  max(h , s[i+1]);
     }
     for( int i = 1; i <= mp[h]; i ++ )
     cout << h ;

    }

#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
using namespace std;
int main()
{string s,x;
	cin >> s;
	x[0] = s[0];
	for (int i = 0; i < s.size(); i++)
	{
		if (x[0] < s[i])
			x[0] = s[i];

	}
	for (int i = 0; i < s.size(); i++)
	{
		if (x[0] == s[i])
			cout << s[i]<<endl;
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin>>s;
    map<char,int>mp;
    for(ll i=0;i<s.size();i++){
        mp[s[i]-'0']++;
    }
    auto it=mp.end();
    it--;
    string ans=string(it->first,it->second);
    cout<<ans;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

string s; string best = "";

bool ispal(string g) {
    for (int i = 0; i < g.length(); ++i)
        if (g[i] != g[g.length()-1-i])
            return false;

    return true;
}

void fuck(int x, string k = "") {
    if (ispal(k) && k > best)
        best = k;
    if (x == s.length()-1)
        return;

        fuck(x+1, k);
        fuck(x+1, k+s[x]);
}

int main() {
    cin >> s;
    fuck(0); cout << best << endl;
}

#include "bits/stdc++.h"
using namespace std;
long long a[100000];
long long i,j,n,d,res;
int main(){
    ios::sync_with_stdio(0);
     cout.tie(0),cin.tie(0);
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    cout<<s[s.size()-1];
    for( int i=s.size()-2;i;i--){
        if(s[s.size()-1]==s[i]){
            cout<<s[i];
        }
        else break;
    }
}

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

using namespace std;

int main(){
    string s;
    cin >> s;

    int L = s.size();

    string ans;

    for(int mask = 1;mask < (1 << L);++mask){
        string aux;

        for(int i = 1;i < L;++i)
            if(mask >> i & 1)
                aux += s[i];

        string aux2 = aux;
        reverse(aux2.begin(),aux2.end());

        if(aux == aux2)
            ans = max(ans,aux);
    }

    cout << ans << '\n';

    return 0;
}

/*
still sad
(1,1)
*/

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
const int N = (int) 3e5 + 113;
const long long MOD = 1e9 + 7;

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

	cin >> s;
	ans += s[0];

	for (int mask = 1; mask < (1 << int(s.size())) - 1; mask++) {
		string curr = "", rruc;
		for (int i = 0; i < s.size(); i++) {
			if (mask & (1 << i))
				curr += s[i];
		}
		rruc = curr;
		reverse(curr.begin(), curr.end());
		if (curr == rruc)
			ans = max(ans, rruc);
	}

	cout << ans;
	return 0;
}

#include <iostream>
#include <string>
using namespace std;
int main()
{
    string s; cin >> s;
    int count = 0;
    char maxChar = s[0];
    for (auto c : s)
    {
        if (c > maxChar)
        {
            maxChar = c;
            count = 1;
        }
        else if (c == maxChar) count++;
    }
    for (int i = 0; i < count - (count % 2); i++) cout << maxChar;
}

#include <bits/stdc++.h>

using namespace std;

int n;
char c[10000007];
string s;
int a[10000007];

int main ()
{
	cin >> n;
	for(int i=1;i<=n;i++)
	cin >> c[i];

	for(int i=1;i<=n;i++)
		if(a[c[i]] == 0){
			s+=c[i];
			a[c[i]]++;
	}
	cout << s;
}

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

/*__builtin_ffsll(input) --> index(1 based) of list significant bit */
/* getline(cin,s) --> line as input */

int main()
{
    string s;
    cin>>s;
    int cnt[27];
    fill(cnt,cnt+27,0);
    for(int i=0; i<s.length(); i++)
        cnt[s[i]-'a']++;
    int mx=0,in;
    for(int i=0; i<26; i++)
        if(mx<=cnt[i])
        {
            mx=cnt[i];
            in=i;
        }
    char c = in+97;
    s.clear();
    s.append(mx,c);
    cout<<s<<'\n';
    return 0;
}

//#include</Users/arav/Downloads/stdc++.h>
#include<bits/stdc++.h>
#define ll long long int
#define all(v) v.begin(),v.end()
#define rep(i,a,b)    for(i=a;i<b;i++)
#define repr(i,a,b)   for(i=a;i>=b;i--)
#define pb push_back
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main()
{ios;
  string name;
  ll i,j;
  char x;
  cin>>name;
  vector<int> v;
   rep(i,0,26)
      {v.pb(0);}
   rep(i,0,name.length())
      {v[int(name[i])-97]++;}
    repr(i,25,0)
      {if(v[i]!=0)
         x='97'+i;
         break;}
     rep(j,0,v[i])
        {cout<<x;}
     return 0;}

#include<bits/stdc++.h>
using namespace std;
#define int         long long
#define ull 		unsigned long long
#define ll 			long long
#define pb 			push_back
#define sll(s)      (s).begin(),(s).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(s,b)    __gcd((s),(b))
#define lcm(s,b)    ((s)*(b)) / gcd((s),(b))
#define ios	    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define lb 			lower_bound
#define ub			upper_bound
#define F           first
#define S           second
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define hell 		(ull)1e9

signed main(void)
{
    //ios
    //freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);

    int TESTS=1;
    //cin>>TESTS;

    while(TESTS--){
   string s;
    cin>>s;

    sort(s.begin(),s.end());
    int n = s.length();

    char a=s[n-1];
    int cnt=0;
    rep(i,s.size()-1,1){
    	if(s[i]==a)
    		cnt++;
    	else
    		break;
    }
    rep(i,cnt,1){
    	cout<<a;
    }
    cout<<endl;

    }
    return 0;

}

/***************** Shuvo *****************/
/****************** DIU *****************/

#pragma comment(linker, "/stack:64000000")

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <algorithm>

using namespace std;

#define phl puts("Hello")
#define sf scanf
#define pf printf
#define fo(i, n) for(i = 0; i < n; i++)
#define of(i, n) for(i = n - 1; i >= 0; i--)
#define CLR(n, v) memset(n, v, sizeof( n ))
#define pb push_back
#define lim(v) v.begin(), v.end()
#define sz(v) ((int)v,size())
#define equals(a, b) (fabs(a-b)<eps)
#define si1(a) scanf("%d", &a)
#define pi1(a) printf("%d\n", a)
#define si2(a, b) scanf("%d %d", &a, &b)
#define pi2(a, b) printf("%d %d\n", a, b)
#define si3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define pi3(a, b, c) printf("%d %d %d\n", a, b, c)

#define white 0
#define black 1

const double PI = 2 * acos ( 0.0 );
const double eps = 1e-9;

typedef long long lld;
typedef unsigned long long llu;
typedef pair<int, int> pi;
typedef  vector<int> vi;
typedef vector<pi> vpi;

template <class T> T jog(T a, T b) { return a + b; }
template <class T> T bog(T a, T b) { return a - b; }
template <class T> T gon(T a, T b) { return a * b; }
template <class T> T sq(T x) {return x * x;}
template <class T> T gcd( T a, T b ) { return b == 0 ? a : gcd(b, a % b); }
template <class T> T lcm ( T a, T b ) { return ( a / gcd ( a, b ) ) * b; }
template <class T> T power ( T a, T p ) { T res = 1, x = a; while ( p ) { if ( p & 1 ) res = res * x; x = x * x; p >>= 1; } return res;}
template <class T> T cordinatlenth(T a, T b, T c, T d) { return sqrt( sq(a - c) + sq(b - d) ); }
template<class T> string toString(T n){ostringstream oss;oss<<n;oss.flush();return oss.str();}
int toInt(string s){int r=0;istringstream sin(s);sin>>r;return r;}
lld bigmod ( lld a, lld p, lld mod )
{
    lld res = 1, x = a;
    while ( p ) {
        if ( p & 1 ) res = ( res * x ) % mod;
        x = ( x * x ) % mod;
        p >>= 1;
    }
    return res;
}

/*
#define M 1000005
int phi[M];

void calculatePhi()
{
    for (int i = 1; i < M; i++) phi[i] = i;
    for (int p = 2; p < M; p++)
        if (phi[p] == p) // p is a prime
            for (int k = p; k < M; k += p) phi[k] -= phi[k] / p;
}
*/

/*
const int pr = 500001;
int prime[ 41539 ], ind;
bool mark[ pr ];
void primelist()
{
    for(int i = 4; i < pr; i += 2) mark[ i ] = false;
    for(int i = 3; i < pr; i += 2) mark[ i ] = true; mark[ 2 ] = true;
    for(int i = 3, sq = sqrt( pr ); i < sq; i += 2)
        if(mark[ i ])
            for(int j = i * i; j < pr; j += i + i) mark[ j ] = false;
    prime[ 0 ] = 2; ind = 1;
    for(int i = 3; i < pr; i += 2)
        if(mark[ i ]) ind++; printf("%d\n", ind);
}
*/

int diraction1[] = {-1, 0, 0, 1, 1, -1, -1, 1};
int diraction2[] = {0, -1, 1, 0, 1, -1, 1, -1};
int horsed1[] = {-2, -2, -1, 1, 2, 2, 1, -1};
int horsed2[] = {1, -1, -2, -2, -1, 1, 2, 2};

#define check(n, pos) (n & (1<<(pos)))
#define biton(n, pos) (n | (1<<(pos)))
#define bitoff(n, pos) (n & ~(1<<(pos)))

void Input();
const int INF = 2147483647;
const long long LINF = 9223372036854775807ll;
/**************************Templet end*********************************/

void solve(int mask);
bool ispalindrome(string s);
string in, ans;

int main()
{
    //#ifdef monkey
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    //#endif
    Input();

    return 0;
    /// Not use cin/cout without necessity. This a causes of TLE :p
}
void Input()
{
	cin >> in;
	ans = "";
	if(ispalindrome( in ))
	{
		ans = in;
	}
	solve( 0 );
	cout << ans << endl;
}
void solve(int mask)
{
	if((1 << in.size()) - 1 == mask) return;
	string s;
	for(int i = 0; i < in.size(); i++)
	{
		if(check(mask, i)) s += in[ i ];
	}
	if(ans > s) return;
	//cout << s << endl;

	if(ispalindrome( s )) ans = max(ans, s);

	for(int i = 0; i < in.size(); i++)
	{
		if(check(mask, i)) continue;
		solve(biton(mask, i));
	}
}
bool ispalindrome(string s)
{
	int a = 0, b = s.size() - 1;
	while(a < b)
	{
		if(s[ a ] != s[ b ]) return false;
		a++; b--;
	}
	return true;
}

#include<iostream>
using namespace std;

int main()
{
    string s;
    cin>>s;
    char p=s.at(0);
    int count=0;
    for(int i=1;i<s.size();i++)
    {
        if(s.at(i)>p)
        {
            p=s.at(i);
        }
        else if(s.at(i)==p)
        {
            count++;
        }

    }
    string n="";
    for(int i=0;i<=count;i++)
    {
        n=p+n;
    }
    cout<<n<<endl;
    return 0;
}

#include<bits/stdc++.h>

int main() {
	char occ[26] = {0};
	char c;
	char str[111];
	char best = 'a';
	scanf("%s",&str);
	for(int i = 0; i < strlen(str); i++) {
		c = str[i];
		occ[c-'a']++;
		if(c > best)
			best = c;
	}
	if(occ[best-'a']%2==1) occ[best-'a']--;
	for(int i = 0; i < occ[best-'a']; i++) printf("%c",best);
	printf("\n");
	return 0;
}

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <complex>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

int main(){
	string s;
	cin >> s;
	sort(ALL(s), greater<char>());
	REP(i,s.size()-1) {
		cout << s[i];
		if(s[i] != s[i+1]){
			break;
		}
	}
	cout << endl;
	return 0;
}