//Problem "String"
//9th Internet Olympiad, season 2007-2008
//Problem Author:  Fedor Tsarev, tsarev@rain.ifmo.ru
//Solution Author: Vladimir Ulyantsev, ulyantsev@rain.ifmo.ru

import java.io.*;
import java.util.*;
import java.math.*;

public class string_vu {

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new FileReader("string.in"));
		PrintWriter out = new PrintWriter(new File("string.out"));
		
		String s = in.readLine();
		int len = s.length();
		char min = 'z';
		char max = 'a';
		for (int i = 0; i < len; i++) {
			char t = s.charAt(i);
			if (t < min) {
				min = t;
			}
			if (t > max) {
				max = t;
			}
		}

		int lastMin = -1;
		int lastMax = -1;
		int minLen = 10000000;
		int first = -1;
		for (int i = 0; i < len; i++) {
			char t = s.charAt(i);
			if (t == min) {
				lastMin = i;
			}
			if (t == max) {
				lastMax = i;
			}
			if (lastMin >= 0 && lastMax >= 0 && Math.abs(lastMin - lastMax) + 1 < minLen) {
				first = Math.min(lastMin, lastMax);
				minLen = Math.abs(lastMin - lastMax) + 1;
			}
		}

		for (int i = first; i < first + minLen; i++) {
			out.print(s.charAt(i));
		} 

		//out.print(min + " " + max);

		in.close();
		out.close();
	}

}