print the substring of a given string