Get Longest Prefix