3
The same task as Finding "sub-palindromes" but instead of finding substrings you must find subsequences that are not substrings.
eg1:
input: "12131331"
output:
"11", "33", "111", "121", "131", "313", "333", "1111", "1331", "11311", "13331"
or
"11", "33", "111", "333", "1111", "11311", "13331"
eg2:
input: "3333"
output:
"33", "333"
or
(null)
- Input is a string of printable ascii characters.
- Output is a list of unique strings.
- If a subsequence also appears as a substring it may be omitted.
- Shortest code wins.
It may be omitted or it must be omitted? Header and details don't match. – J B – 2011-02-11T23:29:40.033
@J B: may be omitted. Where is the mismatch? – Eelvex – 2011-02-11T23:34:43.497
@Eelvex "subsequences that are not substrings". That part reads like substrings aren't allowed. – J B – 2011-02-11T23:53:30.137
@J-B: Substrings are not allowed. What you may or may not omit is a subsequence that also appears as a substring. Take a look at the examples: "1331" is a subsequence "12 13 13 31 " but also a substring "1213 1331 " so you may omit it. – Eelvex – 2011-02-12T00:09:07.643
1@Eelvex: look at it this way. The example output includes "1331". But "1331" is a substring. Thus I don't understand why it's there, given that substrings are not allowed. – J B – 2011-02-12T11:12:00.207
@J-B: Look at it this way: use sequence indexes instead of values. The sequence I'm referring to is "2367" while the sequence you are referring to is "4567". They are completely different but happen to have the same value so you may omit the sequence if it is easier to code it that way. – Eelvex – 2011-02-12T11:35:20.840
@J-B: When I say "subsequences that are not substrings" I mean the set of subsequences that does not include the subset of substrings. i.e. the relative complement of subsequences to substrings. I think the misunderstanding is that it might seem I mean the list of subsequences that is not common with the list of substrings. – Eelvex – 2011-02-12T11:40:44.050
@J-B: btw, you'are not allowed to print "3333" in the second example because there is no such subsequence; only a substring. – Eelvex – 2011-02-12T11:42:58.010