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
function LengthlongestPrefixSuffix ( s ) { var n = s . length ; var lps = Array . from ( { length : n } , ( _ , i ) => 0 ) ;