import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) { 
            String s = in.next();
            Map<Character,Integer> hs = new TreeMap<>();
            for(int i = 0; i<s.length(); i++){
                if(!hs.containsKey(s.charAt(i))){
                    hs.put(s.charAt(i),1);
                }else{
                    hs.put(s.charAt(i),hs.get(s.charAt(i))+1);
                }
            }
            int max = 0;
            for(int a : hs.values()){
                max = Math.max(a,max);
            }
            while(max>0){
                for(char ch : hs.keySet()){
                    if(hs.get(ch)==max){
                        System.out.print(ch);
                    }
                }
                max--;
            }
        }
    }
}