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.util.*;
    import java.io.*;
     
    public class Main {
	static InputReader scn = new InputReader(System.in);
	static OutputWriter out = new OutputWriter(System.out);
	public static void main(String[] args) {
		// Running Number Of TestCases (t)
		int t = 1;
		while(t-- > 0){
			solve();
		}
		out.close();
	}
     
	public static void dummy(){
		// Dummy Code for Rough
		int n = scn.nextInt();
		out.println(n);
	}
		
	public static void solve() {
		// Main Solution (AC)	
		String s = scn.next();
		int max = 0;
		int n = s.length();
		for(int i = 0; i < n; i++) {
			char ch = s.charAt(i);
			max = Math.max(max, ch - '0');
		}
		for(int i = 0; i < n; i++) {
			if((int) (s.charAt(i) - '0' ) == (int) (max)) out.print(s.charAt(i));
		}
		out.println();

	}

    	public static long lcm(long a, long b) {
		return (a * b) / gcd(a, b);
	}
     
	public static long gcd(long a, long b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}
	public static HashMap<Integer, Integer> CountFrequencies(int[] arr) {
     
		HashMap<Integer, Integer> map = new HashMap<>();
		for (int i : arr) {
			if (map.containsKey(i)) map.put(i, map.get(i) + 1);
			else map.put(i, 1);
		}
		return map;
	}
     
	public static HashMap<Integer, Integer> sortByValue(HashMap<Integer, Integer> hm) {

	    List<Map.Entry<Integer, Integer> > list = new LinkedList<Map.Entry<Integer, Integer> >(hm.entrySet());

	    Collections.sort(list, new Comparator<Map.Entry<Integer, Integer> >() { 

		public int compare(Map.Entry<Integer, Integer> o1, Map.Entry<Integer, Integer> o2) { 

		    return (o1.getValue()).compareTo(o2.getValue()); 
		} 
	    });

	    HashMap<Integer, Integer> temp = new LinkedHashMap<Integer, Integer>(); 

	    for (Map.Entry<Integer, Integer> aa : list) { 
			temp.put(aa.getKey(), aa.getValue()); 
	    } 
	    return temp; 
	} 

	public static void sort(int[] arr) {
		Random rand = new Random();
		int n = arr.length;
		for(int i = 0; i<n; i++) {
			swap(arr, i, rand.nextInt(n));
		}
		Arrays.sort(arr);
	}
 
	public static void swap(int[] arr, int i, int j) {
		if(i!=j) {
			arr[i] ^= arr[j];
			arr[j] ^= arr[i];
			arr[i] ^= arr[j];
		}
	}
     
	public static void sortbyColumn(int[][] arr, int col) {

		Arrays.sort(arr, new Comparator<int[]>() {

			public int compare(final int[] entry1, final int[] entry2) {

				if (entry1[col] > entry2[col])
					return 1;
				else
					return -1;
			}
		});
	}

     
	public static void ArraySort2D(int[][] arr, int xy) {
		// xy == 0, for sorting wrt X-Axis
		// xy == 1, for sorting wrt Y-Axis
		Arrays.sort(arr, Comparator.comparingDouble(o -> o[xy]));
	}
	
	public static int binarySearch(int arr[], int l, int r, int x) {
		if (r >= l) {
			int mid = l + (r - l) / 2;
			if (arr[mid] == x)
				return mid;
			if (arr[mid] > x)
				return binarySearch(arr, l, mid - 1, x);
			return binarySearch(arr, mid + 1, r, x);
		}
		return -1;
	}
     
	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
     
		public InputReader(InputStream stream) {
			this.stream = stream;
		}
     
		public int[] readArrays(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = scn.nextInt();
			}
			return a;
		}
     
		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
     
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
     
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
     
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
     
		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
     
		public String next() {
			return nextLine();
		}
     
		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
     
	static class OutputWriter {
		private final PrintWriter writer;
     
		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}
     
		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}
     
		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0) {
					writer.print(' ');
    //                    writer.print(1);
				}
				writer.print(objects[i]);
			}
		}
     
		public void println(Object... objects) {
			print(objects);
			writer.println();
		}
     
		public void close() {
			writer.close();
		}
	}
}