New Distinct Substrings

SPOJ - SUBST1