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