For a given input string(str), write a function to print all the possible substrings. A substring is a contiguous sequence of characters within a string. Example: "cod" is a substring of "coding".