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".

Input

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

Output

Print the lexicographically largest palindromic subsequence of string s.

Examples

Input

radar


Output

rr


Input

bowwowwow


Output

wwwww


Input

codeforces


Output

s


Input

mississipp


Output

ssss

Note

Among 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".
import java.io.*;
import java.util.StringTokenizer;


public class A202 {

    StringTokenizer st;
    BufferedReader in;
    PrintWriter out;

    public static void main(String[] args) throws IOException {
        A202 solver = new A202();
        solver.open();
        solver.solve();
        solver.close();
    }

    private void close() throws IOException {
        in.close();
        out.close();
    }

    private void solve() throws IOException {
      char[] str = nextToken().toCharArray();
       int mask=1;
        StringBuilder good = null;
        while (mask<Math.pow(2, str.length)) {
            StringBuilder buf = new StringBuilder();

            for (int i = 0; i < str.length; i++) {
                if((mask&(1<<i))!=0) {
                    buf.append(str[i]);
                }
            }
            //out.println(buf);
            if(good == null || sravn(buf, good) && polindrom(buf))
                good = buf;

            mask++;
        }
        out.print(good);

    }

    private boolean polindrom(StringBuilder buf) {
        for (int i = 0; i < buf.length() / 2; i++) {
            if(buf.charAt(i)!=buf.charAt(buf.length()-1-i)) return  false;
        }
        return  true;
    }


    private boolean sravn(StringBuilder buf, StringBuilder good) {
        int i;
        for (i = 0; i<buf.length() && i<good.length();i++) {
            if(buf.charAt(i)!=good.charAt(i)) return (buf.charAt(i)>good.charAt(i))?true:false;
        }
        if(buf.length()>good.length()) return true;
        else return false;
    }


    private void open() throws FileNotFoundException {
        // in = new BufferedReader(new InputStreamReader(new FileInputStream("fraud.in")));
        //out = new PrintWriter(new BufferedOutputStream(new FileOutputStream("fraud.out")));
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
    }

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

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

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

    private String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String str = in.readLine();
            if (str == null) return null;
            st = new StringTokenizer(str);
        }
        return st.nextToken();
    }

    private boolean hasMoreTokens() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String str = in.readLine();
            if (str == null) return false;
            st = new StringTokenizer(str);
        }
        return true;    }

}