new method longestCommonPrefixLength