I have a string: "abcd" and I want to:
Iterate its prefixes from shortest to longest:
"", "a", "ab", "abc", "abcd"
Iterate its prefixes from longest to shortest:
"abcd", "abc", "ab", "a", ""
Iterate its suffixes from shortest to longest:
"", "d", "cd", "bcd", "abcd"
Iterate its suffixes from longest to shortest:
"abcd", "bcd", "cd", "d", ""