Returns length of the longest prefix which is also suffix and the two do not overlap . This function mainly is copy of computeLPSArray ( ) in KMP Algorithm
static int LengthlongestPrefixSuffix ( string s ) { int n = s . Length ; int [ ] lps = new int [ n ] ;