import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String str = scanner.next();
String subStr = str;
for (int i = 0; i < str.length(); i++) {
for (int j = i + 1; j < str.length(); j++) {
if (str.charAt(i) == str.charAt(j)){
if (str.substring(i,j+1).length() < subStr.length()){
subStr = str.substring(i,j+1);
}
}
}
}
System.out.println(subStr);
}
}