Not getting all the substrings


in this code im not getting all substrings for IP 1234