Simple Math : Number of Divisors
SUFFIX ARRAY + LCP(Longest Common Prefix) (SPOJ PROBLEM SUBST1)