I am able print the number of substrings correctly but the substrings are not getting printed in the output