A utility function to find longest common extension from index - L and index - R
static int LCE ( String str , int n , int L , int R ) { int length = 0 ; while ( R + length < n && str . charAt ( L + length ) == str . charAt ( R + length ) ) length ++ ; return ( length ) ; }