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.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import static java.lang.System.*;


public class NewClass {
    public static BufferedReader br;
    static FastReader s = new FastReader();
    public static BufferedWriter bor = new BufferedWriter(new OutputStreamWriter(out));
    public static void main(String[] args) throws IOException{
        //int t = s.nextInt();
        //while(t-->0){
                solve();
        //}
    }
    
    static void solve() throws IOException{
       String ab = s.next();
       char [] a = ab.toCharArray();
       Arrays.sort(a);
       for(int i = a.length-1; i >= 0;i--){
           if(a[i] == a[a.length-1])
               print(a[i]);
       }
        System.out.println("");
    }

    static class FastReader{
        private StringTokenizer st;
        
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        
        String next(){
            while(st == null || !st.hasMoreElements()){
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException ex) {
                    Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            return st.nextToken();
        }
        
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException ex) {
                Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
            }
            return str;
        }
        
        int nextInt(){
            return Integer.parseInt(next());
        }
        
        long nextLong(){
            return Long.parseLong(next());
        }
        
        float nextFloat(){
            return Float.parseFloat(next());
        }
        
        double nextDouble(){
            return Double.parseDouble(next());
        }
    }
    
    static void println(){
        out.println();
    }
    
    static void print(){
        out.print("");
    }
    
    static void println(String flouu){
        out.println(flouu);
    }
        
    static void println(long flouu){
        out.println(flouu);
    }
    
    static void println(double flouu){
        out.println(flouu);
    }
    static void println(float flouu){
       out.println(flouu);
    }
    
    static void println(char flouu){
        out.println(flouu);
    }
    
    static void print(char flouu){
        out.print(flouu);
    }
    
    static void print(String flouu){
        out.print(flouu);
    }
    
    static void print(long flouu){
        out.print(flouu);
    }
    
    static void print(double flouu){
        out.print(flouu);
    }
    static void print(float flouu){
       out.print(flouu);
    }
    
}
