import java.util.Scanner;
public class Main
{   
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = x/1000;
        int b = x/100%10;
        int c = x/10%10;
        int d = x%10;
        int max =a;
        if(max<b) {
        	max = b;
        }
        if(max<c) {
        	max = c;
        }
        if(max<d) {
        	max = d;
        }
        System.out.println(max);
    }
}
/**************************************************************
	Problem: 1718
	User: admin
	Language: Java
	Result: Accepted
	Time:2276 ms
	Memory:40328 kb
****************************************************************/