POJ#1226 suffix array, height array, then binary search, nice algorithm! RANK:24382