import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str1 = in.readLine(); String str2 = in.readLine(); int m = str1.length(); int n = str2.length(); int max = 0;

    int[][] dp = new int[m][n];
    for(int i = 0;i <n;i++){
        if(str1.charAt(0) == str2.charAt(i)){
            dp[0][i] = 1;
            max = Math.max(max,dp[0][i]);
        }
        
    }
    for(int i = 0;i <m;i++){
        if(str1.charAt(i) == str2.charAt(0)){
            dp[i][0] = 1;
            max = Math.max(max,dp[i][0]);
        }
        
    }
    
    for(int i = 1;i < m;i++){
        for(int j = 1;j < n;j++){
            if(str1.charAt(i) == str2.charAt(j) ){
                dp[i][j] = dp[i-1][j-1] +1;
                max = Math.max(max,dp[i][j]);
            }else{
                dp[i][j] = 0;
            }
        }
    }
System.out.println(max);
}

}