What Goes Up |
Write a program that will select the longest strictly increasing subsequence from a sequence of integers.
The input file will contain a sequence of integers (positive, negative, and/or zero). Each line of the input file will contain one integer.
The output for this program will be a line indicating the length of the longest subsequence, a newline, a dash character ('-'), a newline, and then the subsequence itself printed with one integer per line. If the input contains more than one longest subsequence, the output file should print the one that occurs last in the input file.
Notice that the second 8 was not included -- the subsequence must be strictly increasing.
-7 10 9 2 3 8 8 6
4 - -7 2 3 8